File tree Expand file tree Collapse file tree 1 file changed +23
-6
lines changed
Expand file tree Collapse file tree 1 file changed +23
-6
lines changed Original file line number Diff line number Diff line change 1- stages :
2- - build
1+ stages : [mirror]
32
4- build-job :
5- stage : build
3+ mirror_github_mirror_to_github :
4+ stage : mirror
5+ image : alpine:3.19
6+ rules :
7+ - if : ' $CI_COMMIT_BRANCH == "github_mirror"'
8+ before_script :
9+ - apk add --no-cache git
10+ - git config --global user.email "ci@mirror.local"
11+ - git config --global user.name "GitLab CI Mirror"
612 script :
7- - echo "Compiling the code..."
8- - echo "Compile complete."
13+ # Create a bare clone of the GitLab repo (fast + good for pushing refs)
14+ - git clone --bare "$CI_REPOSITORY_URL" repo.git
15+ - cd repo.git
16+
17+ # Add GitHub as a remote (PAT auth via env vars)
18+ - git remote add github "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_OWNER}/${GITHUB_REPO}.git"
19+
20+ # Fetch refs from GitLab origin (to ensure we have the latest)
21+ - git fetch origin
22+
23+ # Push ONLY github_mirror -> rag-sphere
24+ # Use --force if you want GitHub to exactly match (history rewrites allowed).
25+ - git push --force github "refs/heads/github_mirror:refs/heads/rag-sphere"
You can’t perform that action at this time.
0 commit comments