-
Notifications
You must be signed in to change notification settings - Fork 16
Add Claude Code GitHub Workflow #1541
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
Conversation
WalkthroughTwo new GitHub Actions workflows are introduced: one for automated code review on pull requests using Claude, and another for Claude AI assistance triggered by specific comments or events in issues and pull requests. Both workflows configure permissions, use the Claude Code Action, and provide optional, commented-out customization settings. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Claude finished @elibosley's task —— View job Claude Code PR ReviewI've completed my review of the GitHub Actions workflows. Here's my comprehensive feedback: Review Tasks:
🔍 Review Findings✅ Strengths
|
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
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.
Actionable comments posted: 2
🧹 Nitpick comments (4)
.github/workflows/claude.yml (2)
39-65: Strip trailing spaces & super-fluous blank line to satisfy YAML lint
YAMLlint is currently flagging six trailing-space violations (lines 42, 45, 48, 51, 54, 60) plus an extra blank line at the end (line 65). They don’t hurt execution, but they will keep the workflow from passing any strict CI lint stage and cluttergit diffs.@@ @@ @@ @@ @@ @@ @@ -65 +#
21-26: Re-evaluate necessity ofid-token: writepermission
The workflow doesn’t request any OIDC-based deploy step. Dropping this permission tightens the attack surface.- id-token: write +# id-token: write # uncomment only if OIDC is actually required.github/workflows/claude-code-review.yml (2)
40-56: Eliminate trailing spaces flagged by YAMLlint
Same cleanup as the other workflow—remove the six trailing-space offenders to keep lint green.@@ @@
23-27: Same principle-of-least-privilege note forid-token: write
Unless the action genuinely needs OIDC, consider dropping this permission here as well.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/claude-code-review.yml(1 hunks).github/workflows/claude.yml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/claude.yml
[error] 42-42: trailing spaces
(trailing-spaces)
[error] 45-45: trailing spaces
(trailing-spaces)
[error] 48-48: trailing spaces
(trailing-spaces)
[error] 51-51: trailing spaces
(trailing-spaces)
[error] 54-54: trailing spaces
(trailing-spaces)
[error] 60-60: trailing spaces
(trailing-spaces)
[warning] 64-64: too many blank lines (1 > 0)
(empty-lines)
.github/workflows/claude-code-review.yml
[error] 20-20: trailing spaces
(trailing-spaces)
[error] 27-27: trailing spaces
(trailing-spaces)
[error] 42-42: trailing spaces
(trailing-spaces)
[error] 51-51: trailing spaces
(trailing-spaces)
[error] 56-56: trailing spaces
(trailing-spaces)
[error] 64-64: trailing spaces
(trailing-spaces)
[error] 67-67: trailing spaces
(trailing-spaces)
[error] 70-70: trailing spaces
(trailing-spaces)
[error] 73-73: trailing spaces
(trailing-spaces)
[warning] 78-78: too many blank lines (1 > 0)
(empty-lines)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Build Web App
- GitHub Check: Build API
- GitHub Check: Test API
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
.github/workflows/claude.yml (1)
35-38: Secret name sanity-check
Ensure the repository actually definesCLAUDE_CODE_OAUTH_TOKEN. Missing secrets cause silent job failures that can be hard to trace.
| on: | ||
| pull_request: | ||
| types: [opened, synchronize] |
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.
💡 Verification agent
❓ Verification inconclusive
Secrets unavailable on forks – job will fail
pull_request workflows triggered from forked repositories do not receive repository secrets, so external contributors’ PRs will hit a permission error on the very first run of Claude. If you need reviews on forks, switch to pull_request_target; if not, document that limitation to avoid confusion.
Ensure secrets are available for forked PRs
GitHub Actions workflows triggered by pull_request from forked repos don’t have access to repository secrets. Any steps depending on secrets will fail on external contributors’ PRs.
Suggestions:
- Switch the trigger to
pull_request_targetto allow workflows in forked PRs to access secrets. - Or, if you don’t want to grant secret access, add a note in
.github/workflows/claude-code-review.yml(around line 3) or your contributor docs explaining that this workflow won’t run on forks due to missing secrets.
🤖 Prompt for AI Agents
In .github/workflows/claude-code-review.yml around lines 3 to 5, the workflow is
triggered by pull_request which prevents access to repository secrets for forked
PRs. To fix this, change the trigger from pull_request to pull_request_target to
allow the workflow to access secrets on forked PRs. Alternatively, if you want
to restrict secret access, add a clear note in the workflow file or contributor
documentation explaining that the workflow will not run on forked PRs due to
missing secrets.
| (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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edge case: empty review body breaks contains() filter
For pull_request_review, github.event.review.body can be null when the reviewer only sets a status (approve / request-changes) without a comment. Accessing contains(null, '@claude') raises an evaluation error and will fail the workflow.
Guard with a null-coalescing fallback:
- (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
+ (github.event_name == 'pull_request_review' && github.event.review.body != null && contains(github.event.review.body, '@claude')) ||📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| (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'))) | |
| (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' && github.event.review.body != null && contains(github.event.review.body, '@claude')) || | |
| (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) |
🤖 Prompt for AI Agents
In .github/workflows/claude.yml around lines 16 to 19, the condition uses
contains() on github.event.review.body which can be null if the review has no
comment, causing an evaluation error. Fix this by adding a null-coalescing
fallback to ensure the body is a string before calling contains(), for example
replacing github.event.review.body with github.event.review.body || ''.
pujitm
left a 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.
this is great! in the future, could we also add a workflow to keep our docs in sync?
🤖 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!
Summary by CodeRabbit