Skip to content

fix: allow Claude workflows to create pull requests - #767

Merged
keito4 merged 2 commits into
mainfrom
fix/claude-action-pr-create-tools
May 25, 2026
Merged

fix: allow Claude workflows to create pull requests#767
keito4 merged 2 commits into
mainfrom
fix/claude-action-pr-create-tools

Conversation

@keito4

@keito4 keito4 commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move Claude workflow tool permissions from settings.permissions.allowedTools to claude_args --allowedTools so they are reflected in the Claude SDK allowed tools.
  • Allow gh pr create and related read commands for issue-handling Claude workflows.
  • Pass GH_TOKEN: ${{ github.token }} to Claude action steps so gh can authenticate without committing credentials.
  • Add repo-maintenance checks that recommend the PR creation allowlist and token wiring.
  • Handle duplicate Quality Gate check-runs in Claude Code Review so CI fallback + CI do not keep the review gate waiting until timeout.

Verification

  • actionlint .github/workflows/claude.yml .github/workflows/scheduled-maintenance.yml .github/workflows/claude-code-review.yml templates/workflows/claude.yml templates/workflows/scheduled-maintenance.yml
  • npx prettier --check .github/workflows/claude.yml .github/workflows/scheduled-maintenance.yml .github/workflows/claude-code-review.yml templates/workflows/claude.yml templates/workflows/scheduled-maintenance.yml .claude/commands/repo-maintenance.md
  • git diff --check
  • Live check-run parsing smoke test for duplicate Quality Gate: quality-gates-ok
  • Staged diff credential pattern scan: no findings
  • bash script/security-credential-scan.sh --strict was run; it reports pre-existing false positives in nix/flake.lock rev hashes, unrelated to this PR.

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

GitHub Actions workflows migrate Claude Code action tool configuration from JSON settings blocks to command-line claude_args --allowedTools arguments across templates and production instances, with more specific gh command scoping and explicit token setup, plus validation documentation.

Changes

Claude Code Action Tool Allowlisting Migration

Layer / File(s) Summary
Workflow template migration to claude_args allowlisting
templates/workflows/claude.yml, templates/workflows/scheduled-maintenance.yml
Both templates replace settings JSON with claude_args --allowedTools string arguments; template claude.yml narrows gh tool patterns from wildcard Bash(gh:*) to explicit PR operations (create, view, list, status), while scheduled-maintenance.yml specifies targeted API/issue/PR commands. Both templates now explicitly set GH_TOKEN: ${{ github.token }} in the step environment.
Production workflow instances using new allowlisting format
.github/workflows/claude.yml, .github/workflows/scheduled-maintenance.yml
Actual workflow instances mirror template changes: claude.yml replaces settings-based configuration with narrower --allowedTools list (PR-focused gh commands plus npm/pnpm/npx), scheduled-maintenance.yml switches to claude_args --allowedTools with similar gh API/issue/PR targeting. Both retain GH_TOKEN environment setup.
Repo-maintenance validation documentation and checks
.claude/commands/repo-maintenance.md
Documentation expands scheduled-maintenance.yml checks to validate --create-pr prerequisites (claude_args allowedTools presence, Bash(gh pr create:*) permission, GH_TOKEN specification) with conditional result branching. Claude.yml cost-check table adds allowedTools/Bash/GH_TOKEN validation items and migration alert for legacy settings.permissions.allowedTools format. Validation logic adds issue detection for missing/misconfigured tool arguments in claude.yml workflows.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • keito4/config#603: Updates .claude/commands/repo-maintenance.md CI consistency checks, directly related to this PR's new validation rules for Claude action tool allowlisting.
  • keito4/config#622: Introduced .github/workflows/scheduled-maintenance.yml workflow that this PR now updates with the new claude_args allowlisting pattern.
  • keito4/config#105: Updates tool/command allowlisting configuration in Claude settings, related to this PR's migration of allowlisting from settings JSON to claude_args arguments.

Suggested labels

released, size/S

Poem

🐰 From settings JSON to args so clear,
Tool permissions tighten year by year,
Each workflow gleams with tokens bright,
PR commands scoped just right—
A safer, leaner Claude takes flight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: enabling Claude workflows to create pull requests by adjusting tool permissions and authentication.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description follows the required template structure with all major sections completed: Summary, Why (implicit in the summary), What, How to test (verification steps), and related context.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/claude-action-pr-create-tools

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@keito4 keito4 self-assigned this May 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/claude.yml:
- Line 72: The allowed tools list string in the workflow step (the
--allowedTools value) is missing git commands; update the allowedTools entry
that currently contains "Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr
list:*),Bash(gh pr status:*),Bash(npm:*),Bash(pnpm:*),Bash(npx:*)" to also
include "Bash(git:*)" so it reads with Bash(git:*) included, ensuring the
--allowedTools configuration (the allowedTools flag line) matches
templates/workflows/claude.yml and allows the push-then-gh-pr-create flow to
complete.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5074966e-5b76-47a8-93c3-399b84caff46

📥 Commits

Reviewing files that changed from the base of the PR and between 7288767 and 8792512.

📒 Files selected for processing (5)
  • .claude/commands/repo-maintenance.md
  • .github/workflows/claude.yml
  • .github/workflows/scheduled-maintenance.yml
  • templates/workflows/claude.yml
  • templates/workflows/scheduled-maintenance.yml


# System prompt to automatically create PRs when working on Issues
claude_args: |
--allowedTools "Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh pr status:*),Bash(npm:*),Bash(pnpm:*),Bash(npx:*)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add Bash(git:*) to keep PR-creation flow and template/instance behavior aligned.

This allowlist currently diverges from templates/workflows/claude.yml and may prevent the “push branch, then gh pr create” path from completing end-to-end.

Suggested patch
-            --allowedTools "Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh pr status:*),Bash(npm:*),Bash(pnpm:*),Bash(npx:*)"
+            --allowedTools "Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh pr status:*),Bash(git:*),Bash(npm:*),Bash(pnpm:*),Bash(npx:*)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
--allowedTools "Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh pr status:*),Bash(npm:*),Bash(pnpm:*),Bash(npx:*)"
--allowedTools "Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh pr status:*),Bash(git:*),Bash(npm:*),Bash(pnpm:*),Bash(npx:*)"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/claude.yml at line 72, The allowed tools list string in
the workflow step (the --allowedTools value) is missing git commands; update the
allowedTools entry that currently contains "Bash(gh pr create:*),Bash(gh pr
view:*),Bash(gh pr list:*),Bash(gh pr
status:*),Bash(npm:*),Bash(pnpm:*),Bash(npx:*)" to also include "Bash(git:*)" so
it reads with Bash(git:*) included, ensuring the --allowedTools configuration
(the allowedTools flag line) matches templates/workflows/claude.yml and allows
the push-then-gh-pr-create flow to complete.

@keito4
keito4 merged commit 1a1dbad into main May 25, 2026
12 checks passed
@keito4
keito4 deleted the fix/claude-action-pr-create-tools branch May 25, 2026 01:17
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.112.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant