Skip to content

added new workflow #116

added new workflow

added new workflow #116

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 }} # Ensure this secret exists
fetch-depth: 0 # Needed for merge history
# 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