Skip to content

Commit 305f127

Browse files
authored
Create push_gitlab.yml
1 parent af893b9 commit 305f127

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+
- gitlab
7+
8+
jobs:
9+
push_to_gitlab:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 1 # Shallow clone to speed up initial checkout
17+
18+
- name: Convert to full repository
19+
run: git fetch --unshallow
20+
21+
- name: Ensure main branch exists
22+
run: |
23+
git checkout -b main || git checkout main
24+
25+
- name: Set up Git
26+
run: |
27+
git config --global user.name 'github-actions'
28+
git config --global user.email '[email protected]'
29+
git config --global http.postBuffer 10000000 # 10 MB
30+
31+
- name: Add GitLab remote and push
32+
env:
33+
GITLAB_URL: ${{ secrets.GITLAB_URL }}
34+
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
35+
run: |
36+
git remote set-url origin https://oauth2:$GITLAB_TOKEN@$GITLAB_URL
37+
git push origin main

0 commit comments

Comments
 (0)