Uh oh!
There was an error while loading. Please reload this page.
Add Claude Code GitHub Workflow - #229
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:18f5e9f19d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read |
There was a problem hiding this comment.
Grant the auto-review job PR write access
When this workflow runs on a pull request, the code-review plugin is expected to publish PR feedback, but the job token is limited to pull-requests: read. Anthropic's automatic PR review examples grant pull-requests: write and describe the expected output as posted PR comments (https://github.com/anthropics/claude-code-action/blob/main/docs/solutions.md#automatic-pr-code-review); with the current read scope, review/comment creation will be denied or produce a run with no PR feedback.
Useful? React with 👍 / 👎.
| contents: read | ||
| pull-requests: read | ||
| issues: read |
There was a problem hiding this comment.
Grant the interactive Claude job write scopes
For @claude requests that ask Claude to reply, update files, or create PRs, this job only gives the action read access to contents, pull requests, and issues. The upstream interactive example grants contents: write, pull-requests: write, and issues: write for the same triggers (https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml), so in repositories with read-only defaults the workflow can start but Claude will fail when it tries to push changes or post comments.
Useful? React with 👍 / 👎.
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write |
There was a problem hiding this comment.
Insufficient permissions for Claude to write back to the PR
Both this workflow and claude.yml set pull-requests: read and issues: read, but Claude needs write access to post review comments, create branches, or push commits. The claude_code_oauth_token authenticates Claude with the AI backend; GitHub API operations (posting comments, creating reviews, pushing code) go through the job's GITHUB_TOKEN, which is governed by this permissions block. With only read on pull-requests and issues, any attempt by Claude to leave a comment or open a review will fail at runtime. At minimum, pull-requests: write and issues: write are required; contents: write is needed if Claude should be able to commit changes. The same issue applies to the identical permissions block in claude.yml (lines 21–26).
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/claude-code-review.yml
Line: 22-26
Comment:
**Insufficient permissions for Claude to write back to the PR**
Both this workflow and `claude.yml` set `pull-requests: read` and `issues: read`, but Claude needs write access to post review comments, create branches, or push commits. The `claude_code_oauth_token` authenticates Claude with the AI backend; GitHub API operations (posting comments, creating reviews, pushing code) go through the job's `GITHUB_TOKEN`, which is governed by this `permissions` block. With only `read` on `pull-requests` and `issues`, any attempt by Claude to leave a comment or open a review will fail at runtime. At minimum, `pull-requests: write` and `issues: write` are required; `contents: write` is needed if Claude should be able to commit changes. The same issue applies to the identical permissions block in `claude.yml` (lines 21–26).
How can I resolve this? If you propose a fix, please make it concise.| # This is an optional setting that allows Claude to read CI results on PRs | ||
| additional_permissions: | | ||
| actions: read |
There was a problem hiding this comment.
Duplicate
actions: read declaration
actions: read is already declared in the job-level permissions block (line 26) and is redundantly restated under additional_permissions. The additional_permissions input is documented for granting permissions beyond what the workflow's token carries; listing one that is already granted there has no effect and is misleading.
| # This is an optional setting that allows Claude to read CI results on PRs | |
| additional_permissions: | | |
| actions: read | |
| # This is an optional setting that allows Claude to read CI results on PRs | |
| #additional_permissions is used for permissions beyond what the job token provides; | |
| # 'actions: read' is already granted in the job permissions block above. |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/claude.yml
Line: 39-41
Comment:
**Duplicate `actions: read` declaration**`actions: read` is already declared in the job-level `permissions` block (line 26) and is redundantly restated under `additional_permissions`. The `additional_permissions` input is documented for granting permissions beyond what the workflow's token carries; listing one that is already granted there has no effect and is misleading.
```suggestion # This is an optional setting that allows Claude to read CI results on PRs # additional_permissions is used for permissions beyond what the job token provides; # 'actions: read' is already granted in the job permissions block above.```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| if: | | ||
| (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || | ||
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || | ||
| (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || | ||
| (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) |
There was a problem hiding this comment.
No actor write-permission check — any commenter can trigger Claude
The trigger condition only checks whether the comment body contains @claude; it does not verify that the actor is a repository collaborator or has write access. On any public or organisation repo where outside users can comment on issues, this means an unauthenticated third party can invoke Claude (and consume the team's API quota) simply by posting a comment with @claude. Adding a check such as github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'OWNER' would restrict execution to trusted contributors.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/claude.yml
Line: 15-19
Comment:
**No actor write-permission check — any commenter can trigger Claude**
The trigger condition only checks whether the comment body contains `@claude`; it does not verify that the actor is a repository collaborator or has write access. On any public or organisation repo where outside users can comment on issues, this means an unauthenticated third party can invoke Claude (and consume the team's API quota) simply by posting a comment with `@claude`. Adding a check such as `github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'OWNER'` would restrict execution to trusted contributors.
How can I resolve this? If you propose a fix, please make it concise.| - name: Run Claude Code Review | ||
| id: claude-review | ||
| uses: anthropics/claude-code-action@v1 |
There was a problem hiding this comment.
Third-party action pinned to a mutable
@v1 tag
anthropics/claude-code-action@v1 resolves to whatever commit the upstream maintainer points that tag at. If the tag is force-pushed with a compromised version, every future run fetches and executes untrusted code with the CLAUDE_CODE_OAUTH_TOKEN secret in scope. GitHub's own hardening guide recommends pinning to a full commit SHA (e.g. anthropics/claude-code-action@<sha>) and verifying it periodically. The same applies to the identical reference in claude.yml (line 35).
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/claude-code-review.yml
Line: 36
Comment:
**Third-party action pinned to a mutable `@v1` tag**`anthropics/claude-code-action@v1` resolves to whatever commit the upstream maintainer points that tag at. If the tag is force-pushed with a compromised version, every future run fetches and executes untrusted code with the `CLAUDE_CODE_OAUTH_TOKEN` secret in scope. GitHub's own hardening guide recommends pinning to a full commit SHA (e.g. `anthropics/claude-code-action@<sha>`) and verifying it periodically. The same applies to the identical reference in `claude.yml` (line 35).
How can I resolve this? If you propose a fix, please make it concise.Uh oh!
There was an error while loading. Please reload this page.
🤖 Installing Claude Code GitHub App
This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.
What is Claude Code?
Claude Code is an AI coding agent that can help with:
How it works
Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
Important Notes
Security
There's more information in the Claude Code action repo.
After merging this PR, let's try mentioning @claude in a comment on any PR to get started!
Greptile Summary
This PR introduces two GitHub Actions workflows to integrate Claude Code into the repository: an automated code-review workflow that triggers on every PR event, and an interactive assistant workflow that responds to
@claudementions in comments and issues.claude-code-review.yml: Runs Claude as an automated reviewer on PR open/sync/reopen events using a plugin-based/code-reviewcommand; currently the job permissions are read-only onpull-requestsandissues, which will prevent Claude from posting review output via theGITHUB_TOKEN.claude.yml: Triggers Claude on@claudementions across issue comments, PR review comments, and reviews; shares the same read-only permission issue, contains a redundantadditional_permissions: actions: read(already declared in the job block), and has no actor authorization guard to restrict triggering to write-access collaborators.Confidence Score: 3/5
Both workflows will silently fail to write back to GitHub until the permissions are corrected; merging as-is means Claude runs but can never post its output.
The job-level permissions in both files are read-only for pull-requests and issues. Since the action relies on the job's GITHUB_TOKEN for GitHub API calls, Claude will authenticate successfully with the AI backend but every attempt to write a comment or review back to the PR will be rejected. The workflows would be non-functional from day one.
Both .github/workflows/claude-code-review.yml and .github/workflows/claude.yml need their permissions blocks updated before the integration will work end-to-end.
Important Files Changed
Sequence Diagram
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: ""Claude Code Review workflow"" | Re-trigger Greptile