Skip to content

Add Claude Code GitHub Workflow - #229

Merged
dodeja merged 2 commits into
mainfrom
add-claude-github-actions-1780082396660
May 29, 2026
Merged

Add Claude Code GitHub Workflow#229
dodeja merged 2 commits into
mainfrom
add-claude-github-actions-1780082396660

Conversation

@dodeja

@dodejadodeja commented May 29, 2026

Copy link
Copy Markdown
Member

🤖 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:

  • Bug fixes and improvements
  • Documentation updates
  • Implementing new features
  • Code reviews and suggestions
  • Writing tests
  • And more!

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

  • This workflow won't take effect until this PR is merged
  • @claude mentions won't work until after the merge is complete
  • The workflow runs automatically whenever Claude is mentioned in PR or issue comments
  • Claude gets access to the entire PR or issue context including files, diffs, and previous comments

Security

  • Our Anthropic API key is securely stored as a GitHub Actions secret
  • Only users with write access to the repository can trigger the workflow
  • All Claude runs are stored in the GitHub Actions run history
  • Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
  • We can add more allowed tools by adding them to the workflow file like:
allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)

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 @claude mentions 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-review command; currently the job permissions are read-only on pull-requests and issues, which will prevent Claude from posting review output via the GITHUB_TOKEN.
  • claude.yml: Triggers Claude on @claude mentions across issue comments, PR review comments, and reviews; shares the same read-only permission issue, contains a redundant additional_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

FilenameOverview
.github/workflows/claude-code-review.ymlAdds automated Claude code review on every PR event; missing write permissions on pull-requests/issues/contents will prevent Claude from posting review comments, and the action is pinned to a mutable @v1 tag.
.github/workflows/claude.ymlAdds @claude mention-triggered assistant workflow; same missing write-permission issue, plus a redundant additional_permissions declaration and no actor authorization check to limit who can invoke Claude.

Sequence Diagram

sequenceDiagram
participant User
participant GitHub
participant ActionsRunner as GitHub Actions Runner
participant ClaudeAction as claude-code-action@v1
participant ClaudeAI as Claude AI (OAuth)
Note over User,ClaudeAI: claude.yml — @claude mention flow
User->>GitHub: "Post comment with @claude"
GitHub->>ActionsRunner: Trigger issue_comment / pull_request_review_comment event
ActionsRunner->>ActionsRunner: Evaluate if condition
ActionsRunner->>ActionsRunner: Checkout repository
ActionsRunner->>ClaudeAction: Run with claude_code_oauth_token
ClaudeAction->>ClaudeAI: Authenticate and send PR/issue context
ClaudeAI-->>ClaudeAction: Response / instructions
ClaudeAction->>GitHub: Post comment / create commit (needs write perms via GITHUB_TOKEN)
Note over User,ClaudeAI: claude-code-review.yml — automated PR review flow
User->>GitHub: Open / update PR
GitHub->>ActionsRunner: Trigger pull_request event
ActionsRunner->>ActionsRunner: Checkout repository
ActionsRunner->>ClaudeAction: Run with plugin code-review + OAuth token
ClaudeAction->>ClaudeAI: Send PR diff and context
ClaudeAI-->>ClaudeAction: Review output
ClaudeAction->>GitHub: Post PR review comment (needs pull-requests write via GITHUB_TOKEN)
Loading
Prompt To Fix All With AI
Fix the following 4 code review issues. Work through them one at a time, proposing concise fixes.
---### Issue 1 of 4
.github/workflows/claude-code-review.yml:22-26
**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).
### Issue 2 of 4
.github/workflows/claude.yml:39-41
**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.```### Issue 3 of 4
.github/workflows/claude.yml:15-19
**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.
### Issue 4 of 4
.github/workflows/claude-code-review.yml:36
**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).

Reviews (1): Last reviewed commit: ""Claude Code Review workflow"" | Re-trigger Greptile

Greptile also left 4 inline comments on this PR.

@vercel

vercelBot commented May 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
apiReadyReadyPreview, CommentMay 29, 2026 7:20pm

Request Review

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +22 to +24
contents: read
pull-requests: read
issues: read

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +22 to +26
permissions:
contents: read
pull-requests: read
issues: read
id-token: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1Insufficient 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.

Comment on lines +39 to +41
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2Duplicate 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.

Suggested change
# 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!

Comment on lines +15 to +19
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')))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2No 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2Third-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.

@dodeja
dodeja merged commit 3a7fa77 into mainMay 29, 2026
16 of 17 checks passed
Sign up for freeto 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.

1 participant

@dodeja