Skip to content

Commit

Permalink
ci: adding GitLab mirroring GitHub Action (#5)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DeveloperC286 committed Jan 25, 2024
1 parent 7ae96d3 commit fbfb59b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/mirroring.yml
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit fbfb59b

Please sign in to comment.