added new github action #115
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 | |
# Configure Git user for the commit | |
- name: Configure Git User | |
run: | | |
# Using generic bot details, you can change these if desired | |
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 the currently checked out demo branch | |
- name: Merge main into demo | |
run: | | |
# Merge main. --no-ff creates a merge commit. | |
# Git automatically uses .gitattributes in the demo branch. | |
git merge --no-ff origin/main -m "Auto-merge main into demo" | |
# This step might fail on complex conflicts not handled by merge=ours. | |
# Push the merge commit back to the demo branch | |
- name: Push changes to demo | |
run: | | |
git push origin demo | |
# actions/checkout@v4 with token handles auth for push |