Skip to content

Commit 96c5ef6

Browse files
Jonathan D.A. Jewellclaude
andcommitted
ci: add hub-and-spoke mirror workflow
Mirrors to GitLab, Codeberg, Bitbucket when enabled via vars. Requires SSH keys in org secrets. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 parents  commit 96c5ef6

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/mirror.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
2+
name: Mirror to GitLab/Codeberg/Bitbucket
3+
4+
on:
5+
push:
6+
branches: [main, master]
7+
workflow_dispatch:
8+
9+
permissions: read-all
10+
11+
jobs:
12+
mirror-gitlab:
13+
runs-on: ubuntu-latest
14+
if: vars.GITLAB_MIRROR_ENABLED == 'true'
15+
steps:
16+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
17+
with:
18+
fetch-depth: 0
19+
- uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
20+
with:
21+
ssh-private-key: ${{ secrets.GITLAB_SSH_KEY }}
22+
- name: Mirror to GitLab
23+
run: |
24+
git remote add gitlab git@gitlab.com:hyperpolymath/${GITHUB_REPOSITORY#*/}.git || true
25+
git push gitlab --all --force
26+
git push gitlab --tags --force
27+
28+
mirror-codeberg:
29+
runs-on: ubuntu-latest
30+
if: vars.CODEBERG_MIRROR_ENABLED == 'true'
31+
steps:
32+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
33+
with:
34+
fetch-depth: 0
35+
- uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
36+
with:
37+
ssh-private-key: ${{ secrets.CODEBERG_SSH_KEY }}
38+
- name: Mirror to Codeberg
39+
run: |
40+
git remote add codeberg git@codeberg.org:hyperpolymath/${GITHUB_REPOSITORY#*/}.git || true
41+
git push codeberg --all --force
42+
git push codeberg --tags --force
43+
44+
mirror-bitbucket:
45+
runs-on: ubuntu-latest
46+
if: vars.BITBUCKET_MIRROR_ENABLED == 'true'
47+
steps:
48+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
49+
with:
50+
fetch-depth: 0
51+
- uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
52+
with:
53+
ssh-private-key: ${{ secrets.BITBUCKET_SSH_KEY }}
54+
- name: Mirror to Bitbucket
55+
run: |
56+
git remote add bitbucket git@bitbucket.org:hyperpolymath/${GITHUB_REPOSITORY#*/}.git || true
57+
git push bitbucket --all --force
58+
git push bitbucket --tags --force

0 commit comments

Comments
 (0)