Repository navigation
Block Claude Code from merging pull requests - #8
Merged
Merged
Conversation
Feediver1
reviewed
Oct 23, 2026
Feediver1
left a comment
Contributor
There was a problem hiding this comment.
PR review: Block Claude Code from merging pull requests (#8)
Overall assessment: Approvable. .claude/settings.json is valid JSON, and its five deny rules match the first five rules of the docs team's standard merge-guard list (docs-team-standards, commands/setup.md, "Merge guard setup", from docs-team-standards#2975).
What the rules cover
Bash(gh pr merge:*):gh pr mergewith any arguments.Bash(gh api *pulls/*/merge*): REST merges such asgh api repos/<owner>/<repo>/pulls/8/merge -X PUT, including when flags come before the path.Bash(gh api graphql *mergePullRequest*)and*enablePullRequestAutoMerge*: GraphQL merge and auto-merge mutations passed inline with-f query=....mcp__github__merge_pull_request: the merge tool of an MCP server registered asgithub.
Critical issues (must fix)
None.
Suggestions
- The team list's close rules are missing. The standard list in
setup.mdalso deniesBash(gh issue close:*)andBash(gh pr close:*). That's fine if this PR is deliberately about merges only. But every repo created from this template would start out with a narrower guard than the team standard. Consider adding both rules, or saying in the PR why they're left out. - A session started above the repo loads none of these rules. Claude Code reads a project's
.claude/settings.jsononly when a session starts in that repo's root. A session started in a parent folder (for example~/projects) loads none of it.setup.mdalready says so and asks each writer to add the same rules to~/.claude/settings.json. This is the template other repos copy, so a line in its README pointing to that user-level setup would close the gap for new repos. - The MCP rule covers one server name.
mcp__github__merge_pull_requestmatches only an MCP server registered asgithub. A GitHub MCP server added under another name isn't blocked. That's fine for today's setup, where the only GitHub connector is read-only, but worth noting next to the rule. - Known limits. These are already documented in
setup.md. Text-matching rules can be worked around by a wrapped command (bash -c, a script,xargs) or by a GraphQL--inputfile, and they don't stop a directgit pushtomain. Branch protection is the guard for that.
What works well
- Deny rules hold in every permission mode, including bypass and auto. That's the right mechanism after the hook-based guard proved unreliable in auto mode (docs-team-standards#2975).
- The rules are identical to the team's standard list, so the template and writers' user-level settings can't drift apart on merges.
- The PR body records a test with a stubbed
ghin bypass and auto mode, covering both refused merges and read-only calls that still work.
Review checked against Claude Code's permission-rule syntax and the docs-team-standards merge-guard list.
Feediver1
approved these changes
Oct 23, 2026
Feediver1
left a comment
Contributor
There was a problem hiding this comment.
Consider the suggestions
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.
Adds a shared
.claude/settings.jsonthat stops Claude Code from merging pull requests in this repo. It blocksgh pr merge, merges throughgh api(REST and GraphQL, including auto-merge), and the GitHub MCP merge tool.Deny rules hold in every permission mode, including bypass. They apply to every PR, your own included, so merging is always done by hand. Reviews, comments, approvals, pushes and opening PRs are not affected.
Tested with a stubbed
ghin bypass and auto mode: every merge route was refused and the read-only calls still ran. Without the file, every command ran.