From 55a156ad1456016c285dfadd15cae9d2d5223990 Mon Sep 17 00:00:00 2001 From: DeveloperC Date: Wed, 24 Jul 2024 14:33:29 +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}"