Skip to content

Merge pull request #181 from nyjc-computing/2026-term2-promotion #73

Merge pull request #181 from nyjc-computing/2026-term2-promotion

Merge pull request #181 from nyjc-computing/2026-term2-promotion #73

Workflow file for this run

name: Sync Branches with Main
on:
push:
branches: [main]
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
strategy:
matrix:
branch: [draft, intake] # Add new branches here
steps:
- name: Checkout Main Branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Git User
run: |
git config user.name "GitHub Action"
git config user.email "action@github.com"
- name: Sync with ${{ matrix.branch }}
run: |
TARGET_BRANCH="${{ matrix.branch }}"
git checkout $TARGET_BRANCH
git pull origin $TARGET_BRANCH || echo "No changes to pull for $TARGET_BRANCH"
# Try fast-forward merge first (only if target is ancestor of main)
if git merge-base --is-ancestor $TARGET_BRANCH origin/main 2>/dev/null; then
git merge --ff-only origin/main && git push origin $TARGET_BRANCH
else
# Branch has diverged - rebase target branch onto main
git rebase origin/main
git push origin $TARGET_BRANCH --force-with-lease
fi