Skip to content

Commit 4cdc6c6

Browse files
authored
Create sync.yml
1 parent 93e7754 commit 4cdc6c6

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/sync.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Sync Repos
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
sync:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set Git User Info
19+
run: |
20+
git config --global user.email "work.adityasodha@gmail.com"
21+
git config --global user.name "workofaditya"
22+
23+
- name: Unshallow Clone (if needed)
24+
run: |
25+
if [ -f .git/shallow ]; then
26+
git fetch --unshallow
27+
else
28+
echo "Repository is already complete. No need to unshallow."
29+
fi
30+
31+
- name: Pull from GitLab
32+
env:
33+
GITLAB_TOKEN: ${{ secrets.GITLAB }}
34+
run: |
35+
git remote add gitlab https://workofaditya:$GITLAB_TOKEN@gitlab.com/workofaditya/ChatBot.git
36+
git fetch gitlab main
37+
git rebase gitlab/main || git rebase --skip
38+
39+
- name: Push to GitLab
40+
env:
41+
GITLAB_TOKEN: ${{ secrets.GITLAB }}
42+
run: |
43+
git push gitlab main

0 commit comments

Comments
 (0)