Skip to content

Require an approving review before auto-merging release PRs - #343

Merged
dwoz merged 1 commit into
mainfrom
require-review-automated-prs
Nov 2, 2026
Merged

dwoz merged 1 commit into
mainfrom
require-review-automated-prs

Conversation

@dwoz

@dwoz dwoz commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Today the `Auto-Merge Automated PRs` workflow (`.github/workflows/auto-merge.yml`) merges any PR labeled `automated-update` as soon as the `Pull Request or Push` workflow finishes green. There is no review gate — meaning the `auto-update-versions` release PR can ship a bundled upstream bump (CPython point releases, OpenSSL/sqlite/expat/etc.) with no human having looked at the diff, which is the whole reason the PR exists.
  • Gate the `gh pr merge` call on at least one `APPROVED` review (via `gh pr view --json reviews --jq '[.reviews[] | select(.state == "APPROVED")] | length'`). If zero, the step logs and exits 0; a later approval + CI re-run will merge normally.

Notes

  • Approvals submitted on an older commit still count under this check. If per-push re-approval is desired, pair this with branch protection on `main` setting Dismiss stale pull request approvals when new commits are pushed.
  • This does not change the `Pull Request or Push` CI itself — all existing checks still have to pass. The approval is an additional gate stacked on top.
  • Non-automated PRs are unaffected; this workflow only acts on PRs labeled `automated-update`.

Motivation

Caught during PR #338 cleanup: a CPython 3.14.9 → 3.14.10 bundled bump silently introduced a FIPS regression (#342). Had the release PR auto-merged on green CI before the FIPS job was noticed, we'd have shipped broken FIPS enforcement for 3.14 users.

Test plan

  • Approve this PR → auto-merge fires normally (one approval present).
  • On the next scheduled `auto-update-versions` run, confirm the regenerated release PR does not merge until approved (expected log line: `PR #N has no approving reviews; skipping auto-merge.`).

The ``Auto-Merge Automated PRs`` workflow merged any PR labeled
``automated-update`` as soon as CI finished green. That means the release
PR auto-generated by ``auto-update-versions.yml`` could ship a bundled
upstream bump (CPython point releases, OpenSSL/sqlite/expat/etc.) without
any human having looked at the diff -- which is the whole reason the PR
exists in the first place.

Gate the ``gh pr merge`` call on at least one ``APPROVED`` review (via
``gh pr view --json reviews``). If no approvals are present, log and
exit 0 so a later approval + CI re-run will merge normally.

Approvals submitted on an older commit still count here; configure
branch protection with ``Dismiss stale pull request approvals when new
commits are pushed`` if a re-approval per push is desired.
@dwoz
dwoz merged commit e676bed into main Nov 2, 2026
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant