Repository navigation
Backlog
Description
Problem
Admins have no way to merge a stack whose requirements aren't met:
gh pr merge <n> --adminis refused for a stacked PR: "This pull request is part of a stack and must be merged using the asynchronous merge REST API."gh stack mergehas no bypass option, and its help says bypassing isn't supported.
But the async merge API already accepts bypass_rules. In a repo whose default branch has a ruleset requiring one approving review, with an admin whose ruleset bypass mode is pull_request:
| Request | Result |
|---|---|
PUT …/pulls/N/merge-async {merge_method, merge_action} |
failed: "At least 1 approving review is required by reviewers with write access." (response echoes bypass_rules: false) |
the same, plus bypass_rules: true |
merged |
Proposed fix (implemented, ready to PR)
Branch: https://github.com/cbcoutinho/gh-stack/tree/merge-admin-flag (compare with main)
I couldn't open the PR myself: the repo doesn't allow pull requests from my account (CreatePullRequest permission error). A maintainer is welcome to open it from the branch, or to enable outside PRs and I'll open it.
gh stack merge --adminsendsbypass_rules: true, in both the headless (--yes/ non-TTY) path and the interactive wizard, and prints a warning before merging. GitHub still decides whether the viewer may bypass.bypass_rulesis omitted from the request body unless--adminis set, so existing requests are unchanged.--adminis refused (exit 5) when the base branch uses a merge queue. I couldn't confirm how the server handles a bypass together with an enqueue, so this fails closed instead of guessing.ClientOps.MergeStackAsynctakes a newbypassRules boolparameter (interface, client, mock, callers).- Docs: CLI reference, README, agent skill reference, workflows guide, FAQ, overview and Merge API reference (
bypass_rulesdocumented). The web-UI note inguides/ui.mdis unchanged. - Tests cover the request body, both merge paths and the merge-queue refusal.
go vet ./...andgo run ./scripts/test -workers 4pass locally.
bypass_rules isn't in the public Merge API docs yet, so please check that it's the intended contract.
This issue was generated with the help of AI, and reviewed by a Human
Metadata
Metadata
Assignees
Labels
No labels
Activity