Skip to content

Commit bc82d88

Browse files
committed
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
1 parent 86ba3d5 commit bc82d88

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.github/workflows/mirroring.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Mirroring
2+
3+
on: [push, delete]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}
7+
8+
jobs:
9+
GitLab:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code.
13+
run: git clone --mirror "https://github.com/${GITHUB_REPOSITORY}.git" "${GITHUB_WORKSPACE}"
14+
- name: Get GitLab repository.
15+
run: echo "REPOSITORY_NAME=$(echo "${GITHUB_REPOSITORY}" | sed "s|^${GITHUB_REPOSITORY_OWNER}/||g")" >> "${GITHUB_ENV}"
16+
- name: Mirroring.
17+
run: git push --mirror "https://oauth2:${{ secrets.GITLAB_PERSONAL_ACCESS_TOKEN }}@gitlab.com/DeveloperC/${REPOSITORY_NAME}"

0 commit comments

Comments
 (0)