gh-prs-merge: merge stacked PRs through the asynchronous merge endpoint (0.45.2) - #87
Merged
Merged
Conversation
…nt (0.45.2)
`gh pr merge` calls the GraphQL mergePullRequest mutation, and GitHub refuses
that mutation outright for a pull request that belongs to a stack, naming the
asynchronous merge REST API instead. Nothing is wrong with such a PR: it reads
MERGEABLE and CLEAN with every check green, so no repair applies and the sweep
just reported FAILED and merged nothing.
`Gh.squashMerge` now falls back to PUT /repos/{owner}/{repo}/pulls/{n}/merge-async
and polls the uuid it returns until the merge settles. The fallback is narrow
on purpose: it fires only on that one refusal message, still pins the head
commit, still asks for a squash, and still passes no --admin, so a PR is held
to exactly the rules it was held to before. A PR the endpoint hands to a merge
queue reports enqueued, which counts as merged because nothing further is ours
to do.
The refusal is matched on the message rather than on the base branch: GitHub
still calls a PR stacked after it has retargeted it onto the default branch,
which is how profullstack/hqtui#96 behaved in practice.
The shell original in profullstack/scripts got the same fix (v0.3.2) and is
being retired in favour of this one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan23 finding(s) HIGH/CRITICAL: 4 | MEDIUM: 10 | LOW: 9
Snippets are redacted; ThreatCrush never prints matched credential material. |
ralyodio
added a commit
to profullstack/scripts
that referenced
this pull request
Sep 24, 2026
profullstack/cli-tools#87 carries the same tool in TypeScript with the fix for GitHub refusing to merge a stacked PR through the GraphQL mutation, plus tests around the asynchronous merge endpoint. Two implementations of one name on PATH is the drift `cli-tools list` marks with `!`, and this pair had already drifted: the shell copy got the fix first, in v0.3.2, and only there. Unlike the gh-pulse retirement, a release WAS cut between the two here, so a box that upgrades past v0.3.2 loses this name until cli-tools installs it. Repoint ~/.local/bin/gh-prs-merge at cli-tools/bin/gh-prs-merge.ts. One behaviour differs and the README says so: repairs were on here unless you passed --no-fix, and are off there unless you pass --fix. The gh-prs-merge-all alias passes neither, so it needs --fix added to keep repairing. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gh-prs-merge: merge stacked PRs through the asynchronous merge endpoint (0.45.2)
gh pr mergecalls the GraphQL mergePullRequest mutation, and GitHub refusesthat mutation outright for a pull request that belongs to a stack, naming the
asynchronous merge REST API instead. Nothing is wrong with such a PR: it reads
MERGEABLE and CLEAN with every check green, so no repair applies and the sweep
just reported FAILED and merged nothing.
Gh.squashMergenow falls back to PUT /repos/{owner}/{repo}/pulls/{n}/merge-asyncand polls the uuid it returns until the merge settles. The fallback is narrow
on purpose: it fires only on that one refusal message, still pins the head
commit, still asks for a squash, and still passes no --admin, so a PR is held
to exactly the rules it was held to before. A PR the endpoint hands to a merge
queue reports enqueued, which counts as merged because nothing further is ours
to do.
The refusal is matched on the message rather than on the base branch: GitHub
still calls a PR stacked after it has retargeted it onto the default branch,
which is how profullstack/hqtui#96 behaved in practice.
The shell original in profullstack/scripts got the same fix (v0.3.2) and is
being retired in favour of this one.
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com