File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Mirror to GitLab
2+
3+ on :
4+ push :
5+ branches :
6+ - ' **'
7+ - ' !main'
8+ - ' !master'
9+
10+ jobs :
11+ mirror :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout
15+ uses : actions/checkout@v4
16+ with :
17+ fetch-depth : 0
18+
19+ - name : Mirror to GitLab
20+ env :
21+ GITLAB_TOKEN : ${{ secrets.GITLAB_TOKEN }}
22+ GITLAB_URL : ${{ vars.GITLAB_URL || 'https://gitlab.com' }}
23+ GITLAB_REPO : ${{ vars.GITLAB_REPO || 'postgres-ai/database-lab' }}
24+ run : |
25+ # Configure git
26+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
27+ git config --global user.name "GitHub Actions"
28+
29+ # Add GitLab remote with token auth
30+ git remote add gitlab "https://oauth2:${GITLAB_TOKEN}@${GITLAB_URL#https://}/${GITLAB_REPO}.git"
31+
32+ # Push the current branch
33+ BRANCH_NAME="${GITHUB_REF#refs/heads/}"
34+ echo "Pushing branch: ${BRANCH_NAME}"
35+ git push gitlab "HEAD:refs/heads/${BRANCH_NAME}" --force
36+
37+ echo "Successfully mirrored to GitLab"
You can’t perform that action at this time.
0 commit comments