Skip to content

Commit 125e976

Browse files
committed
Add Sync to GitLab workflow
1 parent e5a70b9 commit 125e976

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/sync-to-gitlab.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Sync to GitLab
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: "0 2 * * *" # Optional: Runs daily at 2 AM UTC
9+
10+
jobs:
11+
sync:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout the repository
16+
uses: actions/checkout@v3
17+
18+
- name: Configure Git
19+
run: |
20+
git config --global user.name "github-actions[bot]"
21+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
22+
23+
- name: Add GitLab as remote
24+
run: |
25+
git remote add gitlab "${{ secrets.GITLAB_URL }}/${{ secrets.GITLAB_NAMESPACE }}/$GITHUB_REPOSITORY.git"
26+
27+
- name: Push to GitLab
28+
env:
29+
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
30+
run: |
31+
git push --mirror "https://oauth2:${GITLAB_TOKEN}@${{ secrets.GITLAB_URL }}/${{ secrets.GITLAB_NAMESPACE }}/$GITHUB_REPOSITORY.git"

0 commit comments

Comments
 (0)