fix(ci): grant Claude Code Action write perms so reviews can post - #10
Merged
Merged
Conversation
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).
Contributor
There was a problem hiding this comment.
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-requestsandissuespermissions towritein both Claude workflows (andcontents: writeinclaude.ymlwhich handles interactive Claude commands that may push commits) - Bump
actions/checkoutfrom 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.
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.
Problem
The Claude Code Review action ran on every PR but never posted a review/comment.
Root cause
claude-code-actionmints a short-lived GitHub App token that's scoped down to the workflow's declaredpermissions:block (per the action's security model — the token "cannot perform actions beyond the configured permissions"). Both workflows shipped with read-only permissions:So Claude could read the diff and run the review, but every API call to post it was denied. The run exited
successwithpermission_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):pull-requests+issues→writecontents+pull-requests+issues→writeactions/checkoutv4 → 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_requestworkflows use the base-branch (main) YAML, so the fix takes effect once merged.