added new 5 #122
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Demo Branch | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
sync-demo-branch: | |
runs-on: ubuntu-latest | |
steps: | |
# Keep v4 for this test | |
- name: Checkout demo branch | |
uses: actions/checkout@v4 | |
with: | |
ref: 'demo' | |
token: ${{ secrets.DEMO_UPDATE_PAT }} | |
fetch-depth: 0 | |
# Verify .gitattributes (still good practice) | |
- name: Verify .gitattributes | |
run: | | |
echo "Checking .gitattributes content:" | |
cat .gitattributes || echo ".gitattributes not found!" | |
# Configure Git user for the commit | |
- name: Configure Git User | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "actions-bot@github.com" | |
# Disable autocrlf | |
- name: Disable autocrlf | |
run: git config --global core.autocrlf false | |
# Fetch the latest changes from the remote, including main | |
- name: Fetch origin | |
run: git fetch origin | |
# *** CHANGE HERE: Use -X ours strategy *** | |
- name: Merge main into demo using -X ours | |
run: | | |
# Using -X ours to force keeping demo's version on all conflicts | |
git merge --no-ff -X ours origin/main -m "Auto-merge main into demo (using -X ours)" | |
# Push the merge commit (and resolved changes) back to the demo branch | |
- name: Push changes to demo | |
run: | | |
git push origin demo |