Skip to content

feat(release): auto-approve release PRs via dedicated GitHub App - #192

Merged
fiunchinho merged 5 commits into
mainfrom
release-approver-auto-approve
Jun 1, 2026
Merged

feat(release): auto-approve release PRs via dedicated GitHub App#192
fiunchinho merged 5 commits into
mainfrom
release-approver-auto-approve

Conversation

@fiunchinho

@fiunchinho fiunchinho commented Jun 1, 2026

Copy link
Copy Markdown
Member

Stacked on #191 — base is fix-first-release-auto-merge-detection. The diff here shows only the new auto-approve mechanism; #191 must merge first (or the base of this PR retargeted to main).

Summary

gh pr merge --auto never completes on release-please PRs in repos with required-approval branch protection, because nothing satisfies the approval requirement:

  • The PR author is the release-please-workflow App, which cannot self-approve.
  • No human is meaningfully reviewing the auto-generated CHANGELOG diff.
  • bypass_pull_request_allowances on classic branch protection does not allow merging un-approved PRs via the API — empirically verified by attempting gh pr merge --squash authenticated as the bypass App and getting the base branch policy prohibits the merge. The bypass only covers direct branch pushes.

This PR adds an optional auto-approve step that uses a dedicated release-please-approver GitHub App to submit an approving review. The App is intentionally distinct from the release-please App that authors the PR (so the review counts). With approval in place, the existing --auto --squash step merges as soon as required checks pass.

Scope

  • Only approves PRs whose number comes from steps.release_please.outputs.pr — there is no path for this step to touch non-release-please PRs.
  • Optional secrets. RELEASE_PLEASE_APPROVER_CLIENT_ID / RELEASE_PLEASE_APPROVER_PRIVATE_KEY are required: false. Callers that don't provide them see no behavior change.
  • The approval is submitted without a review body — the rationale lives in the YAML comment above the step, not in noise on every release PR.

Caller-side requirements

Repos that want to opt in need to:

  1. Install the release-please-approver App.
  2. Provide the two new secrets (org-level secret is the recommended pattern, mirroring the existing RELEASE_PLEASE_CLIENT_ID / RELEASE_PLEASE_PRIVATE_KEY).
  3. Add the two new entries to the secrets: block of their generated release-please.yaml workflow file. devctl template update required for org-wide rollout — out of scope for this PR.

App permissions — important

The approver App needs Contents: Read and write in addition to Pull requests: Read and write. `Contents: Read` alone is not enough — GitHub will silently submit the review but not count it toward branch protection's required-approval rule (`authorAssociation` reports `NONE` and `reviewDecision` stays `REVIEW_REQUIRED`). This is poorly documented; the symptom is "the approval is recorded but the PR still says review required." Empirically verified end-to-end on `giantswarm/test-release-please`.

Verified end-to-end

Tested on `giantswarm/test-release-please` against the live branch protection (1 required approval). With the approver App's review counting, `gh pr merge --auto --squash` completed the merge and cut `v1.0.0` ~30 seconds after the workflow run started.

Test plan

…ease

The auto-merge reconcile step in the release workflow reads the current
version from .release-please-manifest.json on the base branch. On a fresh
repo the manifest is "{}" until the first release lands, so jq returns
"null" for the "." key. The subsequent numeric -gt comparisons then all
fall through and classify the bump as "none", which is never auto-merged
at any auto-merge-level.

Normalize a missing "." key to "0.0.0" so the first release is bump-classified
correctly (e.g. 0.0.0 -> 1.0.0 = major, 0.0.0 -> 0.1.0 = minor). Whether the
PR actually auto-merges still depends on the configured auto-merge-level.
Branch protection's required-approval rule blocks `gh pr merge --auto` from
ever completing the merge on release-please PRs: the PR author is the
release-please App (which cannot self-approve), no human is meaningfully
reviewing the auto-generated CHANGELOG diff, and bypass_pull_request_allowances
on classic branch protection only allows direct branch pushes — not merging
un-approved PRs via the API (empirically verified).

Add an optional auto-approve step that uses a dedicated `release-please-approver`
App to submit an approving review. The App is intentionally distinct from the
release-please App that authors the PR so the review counts. With approval in
place, the existing `--auto --squash` step merges as soon as required checks pass.

Optional by design: if the approver secrets are not provided, both new steps
are skipped and existing callers see no behavior change.
The body added noise to the PR review history without giving reviewers
useful information. The rationale lives in the YAML comment above the
step, which is the right place for it.
@fiunchinho
fiunchinho marked this pull request as ready for review June 1, 2026 12:11
@fiunchinho
fiunchinho requested a review from a team as a code owner June 1, 2026 12:11
The previous description was 248 chars; project's yamllint config caps lines
at 200. Trim wording without losing the key signal (optional + what gets
skipped when omitted).
Base automatically changed from fix-first-release-auto-merge-detection to main June 1, 2026 12:33
@fiunchinho
fiunchinho merged commit 2a2361e into main Jun 1, 2026
1 check passed
@fiunchinho
fiunchinho deleted the release-approver-auto-approve branch June 1, 2026 13:29
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.

2 participants