Skip to content

gh-prs-merge: merge stacked PRs through the asynchronous merge REST endpoint - #13

Merged
ralyodio merged 1 commit into
mainfrom
worktree-gh-merge-async
Sep 24, 2026
Merged

ralyodio merged 1 commit into
mainfrom
worktree-gh-merge-async

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Merge stacked PRs through the asynchronous merge REST endpoint

GitHub will not merge a pull request that belongs to a stack through the
GraphQL mergePullRequest mutation that gh pr merge calls. It refuses with
a message naming the asynchronous merge REST API, so every stacked PR the
tool judged ready came back as FAILED and the run merged nothing.

Fall back to PUT /repos/{owner}/{repo}/pulls/{n}/merge-async when the refusal
carries that message, then poll the uuid it returns until the merge settles.
The fallback is narrow on purpose: it fires only on that one refusal, still
pins the head commit, still asks for a squash, and still passes no --admin,
so eligibility and branch protections are judged exactly as before. A PR the
endpoint hands to a merge queue reports enqueued, which counts as merged here
because nothing further is ours to do.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

GitHub will not merge a pull request that belongs to a stack through the
GraphQL mergePullRequest mutation that `gh pr merge` calls. It refuses with
a message naming the asynchronous merge REST API, so every stacked PR the
tool judged ready came back as FAILED and the run merged nothing.

Fall back to PUT /repos/{owner}/{repo}/pulls/{n}/merge-async when the refusal
carries that message, then poll the uuid it returns until the merge settles.
The fallback is narrow on purpose: it fires only on that one refusal, still
pins the head commit, still asks for a squash, and still passes no --admin,
so eligibility and branch protections are judged exactly as before. A PR the
endpoint hands to a merge queue reports enqueued, which counts as merged here
because nothing further is ours to do.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 08c4ae0 into main Sep 24, 2026
4 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