Commit 5b45da5
Auto-update auto-merge PRs when main is pushed (#526)
## Problem
When multiple PRs are queued behind each other, GitHub's auto-merge
waits for each PR's branch to be up-to-date with main before merging.
Today that requires someone to click `Update branch` on every PR after
each merge, which is tedious and the checks take a long time.
## Fix
Add `.github/workflows/auto-update-prs.yml` which triggers on every push
to `main` and:
1. Lists all open, non-draft PRs targeting main that have **auto-merge
enabled** (and aren't from forks - `GITHUB_TOKEN` can't push to fork
branches).
2. Calls the GitHub `PUT
/repos/{owner}/{repo}/pulls/{pull_number}/update-branch` API on each one
- the same thing the green `Update branch` button does. It honors the
repo's configured merge method (merge or rebase).
Result: PRs with auto-merge enabled stay current with main
automatically, and the auto-merge queue can flow without manual
intervention.
## Notes
- Uses the built-in `GITHUB_TOKEN`; no PAT or secrets needed.
- 422 responses (already up-to-date / conflicts) are tolerated so one
stuck PR doesn't fail the run.
- `concurrency` is configured with `cancel-in-progress: false` so rapid
pushes to main don't cancel an in-flight update batch.
- Only auto-merge-enabled PRs are touched, so this won't spam CI on
draft / WIP branches.
---------
Co-authored-by: Nikola Metulev <711864+nmetulev@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 44a1179 commit 5b45da5
1 file changed
Lines changed: 82 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
0 commit comments