Claude Code の PR レビューでインラインコメントを付けてもらう
やりたかったこと
Claude Code の PR レビューでインラインコメントを付ける方法を知り、試してみました。
実際に設定してみたところ、こんな感じでインラインコメントが付くようになりました。

ハードコードされた API キーに対して、問題点の説明から修正方法まで具体的に提案してくれています。
インラインコメントに必要な設定
インラインコメントを実現するには、claude-code-action に内蔵されている MCP サーバーのツール mcp__github_inline_comment__create_inline_comment を許可します。
設定箇所は 2 つあります。
1. .claude/settings.json
{
"permissions": {
"allow": [
"mcp__github_inline_comment__create_inline_comment"
]
}
}
2. ワークフローの claude_args
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment"
settings.json と claude_args の両方で指定します。片方だけだとインラインコメントが投稿されないようです。
完成形のワークフロー
上記の設定を含めた完成形のワークフローです。
name: Claude Code PR Review
on:
pull_request:
types: [opened, synchronize]
jobs:
claude-review:
runs-on: self-hosted
permissions:
contents: read
pull-requests: write
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
- name: PR Review with Progress Tracking
uses: anthropics/claude-code-action@0ed5eeaa54d3b0170e79f1ff29996342cf0605f1 # v1.0.40
with:
allowed_bots: "*"
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
settings: .claude/settings.json
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment"
prompt: |
Review this PR and leave inline comments on any issues you find (security vulnerabilities, bugs, type safety, performance).
Repository: ${{ github.repository }}
PR number: ${{ github.event.pull_request.number }}