You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ci): backport every labeled PR in a multi-commit push, not just the head (#6120)
### What changes were proposed in this PR?
`direct-backport-push.yml` resolved exactly one PR per push event — from
`head_commit.message`, falling back to `commits/{context.sha}/pulls`.
When several auto-merges land on `main` in a single ref update, only the
head commit was examined and the `release/*` labels on every other PR in
the same push were silently dropped: no run, no commit status, no
failure comment. An audit of 2026-06-01 → 2026-07-04 found 2 of 43
labeled PRs lost this way (#5802, coalesced behind #5812; and #6111,
coalesced behind #6112).
Changes to the `discover` job:
- Enumerate **all** commits in the push via
`compareCommits(payload.before...context.sha)` (oldest first), falling
back to the head commit if the compare fails or `before` is unavailable.
- Resolve a PR per commit (same two strategies as before: `(#N)` title
suffix, then `commits/{sha}/pulls` with backoff) and collect green
`release/*` targets per PR.
- Output one matrix entry per `(pr_number, merge_sha, target)` pair
instead of a single PR + target list.
Changes to the `push-backports` job:
- Matrix is now `include: <entries>` with `max-parallel: 1`, so
cherry-picks apply in commit order and two legs never race pushes to the
same release branch.
- `MERGE_SHA`/`PR_NUMBER` come from the matrix entry instead of
`github.sha`/a single discover output; the cherry-pick, commit statuses,
and PR comments all annotate the right commit and PR.
- Job legs are named `backport #<pr> to <target>`; the
failure-annotation job-URL matcher was updated accordingly.
### Any related issues, documentation, discussions?
Closes#6119
### How was this PR tested?
- YAML parses (PyYAML) and all three embedded `github-script` blocks
pass `node --check`.
- Dry-ran the new discover logic (read-only API calls) against the two
historical coalesced pushes: the 2026-07-04 push
(`5c4a963f7...9cd8acf`) yields entries for **both** #6111 and #6112
with green targets, and the 2026-06-20 push range yields #5802 while
correctly skipping the unlabeled #5809/#5811/#5812. The old logic
produced only the head PR in each case.
- Note: this fix is not retroactive — #5802 and #6111 still need manual
backporting to `release/v1.2`.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Fable 5)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
0 commit comments