Skip to content

feat(core): pass the merge target check for stacked PRs - #183

Open
thecode wants to merge 1 commit into
OpenHomeFoundation:mainfrom
thecode:merge-target-stacked
Open

thecode wants to merge 1 commit into
OpenHomeFoundation:mainfrom
thecode:merge-target-stacked

Conversation

@thecode

@thecode thecode commented Nov 28, 2026 •

Copy link
Copy Markdown

Proposed change

A stacked PR targets the branch of the PR below it, so the Merge target check warns that it doesn't target dev. There is nothing for the author to do about that: the PR can't merge before the one below it, and GitHub retargets it when that one merges. Example: home-assistant/core#194829 (comment)

With this change the check passes for a member's PR when its base branch is the head of another open PR in the same repository and that stack ends at dev. The message names the PR directly below, for example "This PR is stacked on #194859."

What stays the same:

  • Non-members still fail when they target anything but dev.
  • Backports and release work still warn. An open PR from rc into master doesn't end at dev, so a PR into rc isn't treated as stacked.

The lookup is one GET /repos/{owner}/{repo}/pulls?head=… request per level of the stack, made only for a member's PR that doesn't target dev. It stops after 10 levels or when branches target each other, and then warns as before.

Type of change

  • Dependency upgrade
  • Bugfix
  • New rule or command
  • New repository manifest (enable the bot on another repo)
  • New feature (which adds functionality to an existing engine)
  • Code quality improvement or refactor (incl. tests)

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass (mise run test). Your PR cannot be merged unless tests pass.
  • Lint and type checks pass (mise run check).
  • The code has been formatted (mise run format).
  • Tests have been added to verify that the new code works.
  • There is no commented out or debug code in this PR.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If behaviour, configuration, or environment variables changed:

  • README.md and .env.example have been updated accordingly.

A member's PR whose base is the branch of another open PR, in a stack that ends at dev, now passes the Merge target check instead of getting a warning. It can't merge before the PR below it, so the warning asked for nothing.

Backports and release work still warn: an open PR from rc into master doesn't end at dev. Non-members still fail.
@thecode
thecode marked this pull request as ready for review November 28, 2026 00:34
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