-
Notifications
You must be signed in to change notification settings - Fork 9
37 lines (31 loc) · 1.1 KB
/
mirror-to-gitlab.yml
File metadata and controls
37 lines (31 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Mirror to GitLab
on:
push:
branches:
- '**'
- '!main'
- '!master'
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Mirror to GitLab
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITLAB_URL: ${{ vars.GITLAB_URL || 'https://gitlab.com' }}
GITLAB_REPO: ${{ vars.GITLAB_REPO || 'postgres-ai/postgres_ai' }}
run: |
# Configure git
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
# Add GitLab remote with token auth
git remote add gitlab "https://oauth2:${GITLAB_TOKEN}@${GITLAB_URL#https://}/${GITLAB_REPO}.git"
# Push the current branch
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
echo "Pushing branch: ${BRANCH_NAME}"
git push gitlab "HEAD:refs/heads/${BRANCH_NAME}" --force
echo "Successfully mirrored to GitLab"