added new #118
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: | |
# Checkout the demo branch first, this is where we'll merge into | |
- name: Checkout demo branch | |
uses: actions/checkout@v4 | |
with: | |
ref: 'demo' | |
token: ${{ secrets.DEMO_UPDATE_PAT }} | |
fetch-depth: 0 # Needed for merge history | |
# Verify .gitattributes | |
- 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" | |
# Fetch the latest changes from the remote, including main | |
- name: Fetch origin | |
run: git fetch origin | |
# Perform the merge from main into demo | |
- name: Merge main into demo (preferring main for non-demo conflicts) | |
run: | | |
# Merge main using -X theirs to auto-resolve non-demo conflicts by taking main's version. | |
# .gitattributes merge=ours for demo folders takes precedence. | |
git merge --no-ff -X theirs origin/main -m "Auto-merge main into demo (preferring main for conflicts)" | |
# Push the merge commit (and resolved changes) back to the demo branch | |
- name: Push changes to demo | |
run: | | |
git push origin demo |