Skip to content

Commit afcdc96

Browse files
committed
added new workflow
1 parent 01d3462 commit afcdc96

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.github/workflows/sync-demo-branch.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,27 @@ jobs:
1414
uses: actions/checkout@v4
1515
with:
1616
ref: 'demo'
17-
token: ${{ secrets.DEMO_UPDATE_PAT }}
17+
token: ${{ secrets.DEMO_UPDATE_PAT }} # Ensure this secret exists
1818
fetch-depth: 0 # Needed for merge history
1919

2020
# Configure Git user for the commit
2121
- name: Configure Git User
2222
run: |
23-
# Using generic bot details, you can change these if desired
2423
git config user.name "GitHub Actions Bot"
2524
git config user.email "actions-bot@github.com"
2625
2726
# Fetch the latest changes from the remote, including main
2827
- name: Fetch origin
2928
run: git fetch origin
3029

31-
# Perform the merge from main into the currently checked out demo branch
32-
- name: Merge main into demo
30+
# Perform the merge from main into demo
31+
- name: Merge main into demo (preferring main for non-demo conflicts)
3332
run: |
34-
# Merge main. --no-ff creates a merge commit.
35-
# Git automatically uses .gitattributes in the demo branch.
36-
git merge --no-ff origin/main -m "Auto-merge main into demo"
37-
# This step might fail on complex conflicts not handled by merge=ours.
33+
# Merge main using -X theirs to auto-resolve non-demo conflicts by taking main's version.
34+
# .gitattributes merge=ours for demo folders takes precedence.
35+
git merge --no-ff -X theirs origin/main -m "Auto-merge main into demo (preferring main for conflicts)"
3836
39-
# Push the merge commit back to the demo branch
37+
# Push the merge commit (and resolved changes) back to the demo branch
4038
- name: Push changes to demo
4139
run: |
4240
git push origin demo
43-
# actions/checkout@v4 with token handles auth for push

0 commit comments

Comments
 (0)