Skip to content

fix(ci): grant Claude Code Action write perms so reviews can post - #10

Merged
jarodtaylor merged 1 commit into
mainfrom
fix/claude-action-write-perms
Jun 9, 2026
Merged

jarodtaylor merged 1 commit into
mainfrom
fix/claude-action-write-perms

Conversation

@jarodtaylor

Copy link
Copy Markdown
Owner

Problem

The Claude Code Review action ran on every PR but never posted a review/comment.

Root cause

claude-code-action mints a short-lived GitHub App token that's scoped down to the workflow's declared permissions: block (per the action's security model — the token "cannot perform actions beyond the configured permissions"). Both workflows shipped with read-only permissions:

pull-requests: read
issues: read

So Claude could read the diff and run the review, but every API call to post it was denied. The run exited success with permission_denials_count: 17 — a silent failure (verified in run logs on a prior PR).

The Claude GitHub App having Read/Write doesn't help: the workflow block caps the minted token regardless.

Fix

Match Anthropic's canonical example workflows (examples/pr-review-comprehensive.yml, examples/claude.yml):

  • claude-code-review.yml — pull-requests + issues → write
  • claude.yml — contents + pull-requests + issues → write
  • Bump actions/checkout v4 → v6 (clears the Node 20 deprecation warning seen in run logs)

No run: step consumes untrusted event input, so raising write scope introduces no injection surface.

Verify

After merge, re-trigger the review on an open PR (e.g. push to #9) → a review comment should land. pull_request workflows use the base-branch (main) YAML, so the fix takes effect once merged.

Both workflows shipped with read-only `permissions:` (pull-requests/issues:
read). claude-code-action scopes its GitHub App token down to the workflow's
declared permissions, so the review ran but every attempt to post the review
was denied — the run exited success with permission_denials_count: 17 and no
comment ever appeared.

Bring both to Anthropic's canonical example permissions:
- claude-code-review.yml: pull-requests + issues → write
- claude.yml: contents + pull-requests + issues → write
Also bump actions/checkout v4 → v6 (clears the Node 20 deprecation warning).
Copilot AI review requested due to automatic review settings June 9, 2026 02:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a silent failure where the Claude Code Review action could read PR diffs but never post reviews or comments, because the workflow permissions were set to read for pull-requests and issues. The fix elevates the necessary permissions to write and bumps actions/checkout from v4 to v6.

Changes:

  • Elevate pull-requests and issues permissions to write in both Claude workflows (and contents: write in claude.yml which handles interactive Claude commands that may push commits)
  • Bump actions/checkout from v4 to v6 to clear the Node 20 deprecation warning

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/claude.yml Elevate contents, pull-requests, issues from read to write; bump checkout to v6
.github/workflows/claude-code-review.yml Elevate pull-requests, issues from read to write; bump checkout to v6

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jarodtaylor
jarodtaylor merged commit affc2bc into main Jun 9, 2026
1 of 2 checks passed
@jarodtaylor
jarodtaylor deleted the fix/claude-action-write-perms branch June 9, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants