Skip to content

Commit c9452da

Browse files
committed
Update push_gitlab.yml
1 parent c37a993 commit c9452da

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/push_gitlab.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Push to GitLab
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
mirror_to_gitlab:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0 # Fetch all history to ensure the current branch is fully included
17+
18+
- name: Set up Git
19+
run: |
20+
git config --global user.name 'GitHub Actions'
21+
git config --global user.email '[email protected]'
22+
23+
- name: Add GitLab remote
24+
env:
25+
GITLAB_URL: ${{ secrets.GITLAB_URL }}
26+
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
27+
run: |
28+
git remote set-url origin https://oauth2:$GITLAB_TOKEN@$GITLAB_URL
29+
30+
- name: Push current branch to GitLab
31+
env:
32+
GITLAB_URL: ${{ secrets.GITLAB_URL }}
33+
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
34+
run: |
35+
# Push the current branch to GitLab
36+
git push origin ${{ github.ref_name }}
37+

0 commit comments

Comments
 (0)