guanghu/.github/workflows/auto-update-prs.yml
Guanghu Domestic Migration 9b41d51231
Some checks are pending
Auto-update PR branches / Update open PR branches (push) Waiting to run
CI / Frontend Static Quality Checks (push) Waiting to run
CI / Frontend Tests & Coverage (push) Waiting to run
CI / Rust Tests & Quality Checks (push) Waiting to run
CI / Linux build verification (push) Waiting to run
Deploy docs / Build VitePress site (push) Waiting to run
Deploy docs / Deploy to GitHub Pages (push) Blocked by required conditions
Release (Alpha) / Compute alpha version (push) Waiting to run
Release (Alpha) / Build release artifacts (push) Blocked by required conditions
Release (Alpha) / GitHub Release (alpha) (push) Blocked by required conditions
Release (Alpha) / Update docs and release pages (push) Blocked by required conditions
chore: import sanitized domestic snapshot for REPO-004
Source snapshot: 514ab1975951d94342ea38e64101d5a0f1c51c77
2026-07-17 15:55:28 +08:00

39 lines
1.2 KiB
YAML

name: Auto-update PR branches
# When main advances, automatically update all open PR branches
# so they stay up to date and can be auto-merged without manual rebase.
on:
push:
branches: [main]
jobs:
update-prs:
name: Update open PR branches
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update all open PR branches
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get all open PRs targeting main
PRS=$(gh pr list --base main --state open --json number,headRefName --jq '.[]')
echo "$PRS" | while IFS= read -r pr; do
PR_NUM=$(echo "$pr" | jq -r '.number')
BRANCH=$(echo "$pr" | jq -r '.headRefName')
echo "Updating PR #$PR_NUM ($BRANCH)..."
# GitHub native update — does a merge of main into the branch
gh pr update-branch "$PR_NUM" 2>&1 && echo "✅ #$PR_NUM updated" || echo "⚠️ #$PR_NUM skipped (already up to date or conflict)"
done