File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Mirror to GitLab and Codeberg
2+
3+ on :
4+ push :
5+ branches :
6+ - " **"
7+ tags :
8+ - " *"
9+ workflow_dispatch :
10+ schedule :
11+ - cron : " 17 3 * * *" # daily at 03:17 UTC
12+
13+ jobs :
14+ mirror :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Mirror to GitLab and Codeberg (bare mirror clone)
18+ env :
19+ GITLAB_USERNAME : ${{ secrets.GITLAB_USERNAME }}
20+ GITLAB_TOKEN : ${{ secrets.GITLAB_TOKEN }}
21+ CODEBERG_USERNAME : ${{ secrets.CODEBERG_USERNAME }}
22+ CODEBERG_TOKEN : ${{ secrets.CODEBERG_TOKEN }}
23+
24+ GITLAB_REPO : " sofos-web"
25+ CODEBERG_REPO : " sofos-web"
26+ run : |
27+ set -euo pipefail
28+ export GIT_TERMINAL_PROMPT=0
29+
30+ GITLAB_REPO_URL="https://oauth2:${GITLAB_TOKEN}@gitlab.com/${GITLAB_USERNAME}/${GITLAB_REPO}.git"
31+ CODEBERG_REPO_URL="https://${CODEBERG_USERNAME}:${CODEBERG_TOKEN}@codeberg.org/${CODEBERG_USERNAME}/${CODEBERG_REPO}.git"
32+
33+ # Create a bare mirror clone of the *current* GitHub repo
34+ git clone --mirror "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" repo.git
35+ cd repo.git
36+
37+ # Push everything (all refs + deletions)
38+ git push --mirror "${GITLAB_REPO_URL}"
39+ git push --mirror "${CODEBERG_REPO_URL}"
You can’t perform that action at this time.
0 commit comments