From bc82d88eeb2bd3d24a29dc83df99fffed9862d8e Mon Sep 17 00:00:00 2001 From: DeveloperC Date: Wed, 17 Apr 2024 13:49:54 +0100 Subject: [PATCH] ci: adding GitLab mirroring GitHub Action Mirror creates new references such as branches and tag. It updates existing references and it deletes references when they no longer exist in the source but do in the mirror. * https://git-scm.com/docs/git-push#Documentation/git-push.txt---mirror * https://christoph.ruegg.name/blog/git-howto-mirror-a-github-repository-without-pull-refs --- .github/workflows/mirroring.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/mirroring.yml diff --git a/.github/workflows/mirroring.yml b/.github/workflows/mirroring.yml new file mode 100644 index 0000000..c1d48ff --- /dev/null +++ b/.github/workflows/mirroring.yml @@ -0,0 +1,17 @@ +name: Mirroring + +on: [push, delete] + +concurrency: + group: ${{ github.workflow }} + +jobs: + GitLab: + runs-on: ubuntu-latest + steps: + - name: Checkout code. + run: git clone --mirror "https://github.com/${GITHUB_REPOSITORY}.git" "${GITHUB_WORKSPACE}" + - name: Get GitLab repository. + run: echo "REPOSITORY_NAME=$(echo "${GITHUB_REPOSITORY}" | sed "s|^${GITHUB_REPOSITORY_OWNER}/||g")" >> "${GITHUB_ENV}" + - name: Mirroring. + run: git push --mirror "https://oauth2:${{ secrets.GITLAB_PERSONAL_ACCESS_TOKEN }}@gitlab.com/DeveloperC/${REPOSITORY_NAME}"