-
Notifications
You must be signed in to change notification settings - Fork 487
Add Claude GitHub actions #34403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add Claude GitHub actions #34403
Conversation
Only allow OWNER, MEMBER, and COLLABORATOR to trigger the @claude assistant workflow. This prevents random external users from consuming API quota on the public repository.
Since we're using claude_code_oauth_token for authentication, we don't need id-token: write (which is only for OIDC auth with Bedrock/Vertex). Keep actions: read in the assistant workflow since it explicitly uses additional_permissions to read CI results.
Pin actions/checkout and anthropics/claude-code-action to specific commit SHAs to prevent supply-chain attacks via compromised tags. - actions/checkout: v4.2.2 -> 11bd719 - anthropics/claude-code-action: v1 -> 3a38b37 These should be updated periodically when new versions are released.
Remove issue creation/assignment and PR review submission events, keeping only comment-based triggers. This reduces the event surface area and ensures @claude is only invoked through explicit comment mentions, making it harder to trigger accidentally.
|
I think it might be good to outline what we're trying to (and not trying to) achieve with AI code reviews. |
| claude-review: | ||
| if: | | ||
| ( | ||
| github.event_name == 'issue_comment' && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? In your description you said:
With these changes, it is only possible to use Claude from PR comments
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty old, but doesn't matter I guess.
|
|
||
| - name: Run Claude Code Review | ||
| id: claude-review | ||
| uses: anthropics/claude-code-action@3a38b377b30c75102b420405ed9516b57ca2e248 # v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't even find this commit in their repo: anthropics/claude-code-action@3a38b37 So I think this won't work.
Also "v1" is kind of non-descript, would be better to say which specific one we use, for example v1.0.22
| - Security concerns | ||
| - Test coverage | ||
|
|
||
| Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file doesn't exist, did you mean doc/developer/{best-practices.md,guide-changes.md}?
| - Potential bugs or issues | ||
| - Performance considerations | ||
| - Security concerns | ||
| - Test coverage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this something more targeted?
| - Test coverage | |
| - Were relevant e2e tests added/changed, do they consider corner cases and check relevant results? |
I'm still worried that Claude probably has no idea about what testing frameworks we have and whether they are used for the correct kind of testing.
|
|
||
| # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md | ||
| # or https://code.claude.com/docs/en/cli-reference for available options | ||
| claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issues again?
|
|
||
| Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback. | ||
|
|
||
| Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bet you can make Claude comment something on another person's PR from what you write in the body of your own PR. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
claude-code-review.yml is for code reviews. What is this file for? I don't see that Claude has any permissions to do something here?
22d57f9 to
b24dcc1
Compare
Add the Claude Code GitHub actions associated with the Claude / GitHub integration.
The security recommendations here are implemented as follow up commits:
https://chatgpt.com/share/e/693213d7-032c-8000-b36e-fa22ad663b64
With these changes, it is only possible to use Claude from PR comments. Possibly a moot point for this repo, since issues are disabled/hosted elsewhere.
Use only from comments is still useful: You can use it to conduct a review of code in the PR, or to add code/documentation to the (possibly stub) PR.