Skip to content

feat(release): add auto-merge-level input for release-please PRs - #185

Merged
fiunchinho merged 3 commits into
mainfrom
auto-merge-release-please-prs
May 27, 2026
Merged

feat(release): add auto-merge-level input for release-please PRs#185
fiunchinho merged 3 commits into
mainfrom
auto-merge-release-please-prs

Conversation

@fiunchinho

Copy link
Copy Markdown
Member

What

Adds an auto-merge-level input (none, patch, minor, major; default none) to the release.yaml release-please reusable workflow. When set, the workflow enables GitHub auto-merge (gh pr merge --auto --squash) on the open release-please PR when the PR's bump is no larger than the configured ceiling, so the PR merges automatically once CI passes.

How it works

  • Bump detection is derived from .release-please-manifest.json — the next version on the PR head branch vs. the current version on the base branch — so it is independent of each caller's release-please PR-title configuration.
  • Decision: merge when 1 ≤ bump_level ≤ auto-merge-level, using the ordering none(0) < patch(1) < minor(2) < major(3).
  • Reconciled every run: the step reads the PR's current auto-merge state and only acts on a change. If a release-please PR's bump grows past the ceiling (e.g. patchmajor) before it is merged, auto-merge is disabled again.
  • Attribution: the merge runs with the release-please GitHub App token, so the commits, the PR, and the merge are all attributed to the App.

Test scenarios (latest release 1.3.1)

release auto-merge-level result
2.0.0 minor not merged (major > minor)
1.3.2 minor merged (patch ≤ minor)
1.4.0 minor merged (minor ≤ minor)

Operational prerequisites (per consuming repo, outside this workflow)

  • The release-please GitHub App must be granted bypass on the branch protection rule / ruleset.
  • "Allow auto-merge" must be enabled in the repo, with required status checks on the protected branch.

The default none preserves the previous behaviour, so existing callers are unaffected until they opt in.

Add an `auto-merge-level` input (none, patch, minor, major; default
none) to the release-please reusable workflow. When set, the workflow
enables GitHub auto-merge (`gh pr merge --auto --squash`) on the open
release-please PR when the PR's bump is no larger than the configured
ceiling, so it merges once CI passes.

The bump is derived from `.release-please-manifest.json` (next version
on the PR head branch vs. current version on the base branch), so it is
independent of each caller's PR-title configuration. Auto-merge is
reconciled on every run: if a PR's bump grows past the ceiling before
it is merged, auto-merge is disabled again.

The merge runs with the release-please GitHub App token, so it is
attributed to the App. The App must be granted bypass on branch
protection and the repo must have "Allow auto-merge" enabled.
@fiunchinho fiunchinho self-assigned this May 27, 2026
If a consuming repo hasn't enabled "Allow auto-merge" or hasn't granted
the release-please App branch-protection bypass, enabling auto-merge on
the release PR should not fail the whole release workflow run. Soft-fail
the `gh pr merge --auto` call with a ::warning:: annotation instead, so
the misconfiguration is surfaced without breaking the release.

@QuentinBisson QuentinBisson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM at first glance :)

… is none

Address two code-review findings on the auto-merge reconcile step:

- Soft-fail the `gh pr merge --disable-auto` call with a ::warning::
  annotation, symmetrically with the enable path, so a transient API
  error or a race doesn't hard-fail the release run.
- Guard the step with `inputs.auto-merge-level \!= 'none'`, so the
  default `none` is a true no-op and never disables an auto-merge that
  was enabled outside this workflow.
@fiunchinho
fiunchinho marked this pull request as ready for review May 27, 2026 16:13
@fiunchinho
fiunchinho requested a review from a team as a code owner May 27, 2026 16:14
@fiunchinho
fiunchinho merged commit 7a3c79b into main May 27, 2026
1 check passed
@fiunchinho
fiunchinho deleted the auto-merge-release-please-prs branch May 27, 2026 16:14
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