@@ -2,7 +2,8 @@ name: Sync Branches with Main
22
33on :
44 push :
5- branches : [main]
5+ branches :
6+ - main
67
78permissions :
89 contents : write
@@ -11,40 +12,26 @@ jobs:
1112 sync :
1213 runs-on : ubuntu-latest
1314 steps :
14- - name : Checkout Main Branch
15+ - name : Checkout repository
1516 uses : actions/checkout@v3
1617 with :
1718 fetch-depth : 0
1819
19- - name : Setup Git User
20+ - name : Set up Git user
2021 run : |
2122 git config user.name "GitHub Action"
2223 git config user.email "action@github.com"
2324
24- - name : Sync with Dev Branch (Squash Merge)
25+ - name : Sync content branch with main
2526 run : |
26- git checkout main
27- git pull origin main
28- git checkout dev
29- git pull origin dev
30- git merge --squash origin/main || echo "No changes to merge for dev"
31- if [ -n "$(git status --porcelain)" ]; then
32- git commit -m "Squash merge changes from main into dev"
33- git push origin dev
34- else
35- echo "No changes to commit for dev"
36- fi
27+ git fetch origin main
28+ git checkout content
29+ git reset --hard origin/main
30+ git push origin content --force
3731
38- - name : Sync with Content Branch (Squash Merge)
32+ - name : Sync dev branch with main
3933 run : |
40- git checkout main
41- git pull origin main
42- git checkout content
43- git pull origin content
44- git merge --squash origin/main || echo "No changes to merge for content"
45- if [ -n "$(git status --porcelain)" ]; then
46- git commit -m "Squash merge changes from main into content"
47- git push origin content
48- else
49- echo "No changes to commit for content"
50- fi
34+ git fetch origin main
35+ git checkout dev
36+ git reset --hard origin/main
37+ git push origin dev --force
0 commit comments