-
-
Notifications
You must be signed in to change notification settings - Fork 193
Add Claude Code GitHub Workflow #77
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 automates code review on pull requests using the Claude Code Review action, and the other triggers the Claude AI assistant based on specific phrases in issues, comments, or review events. Both workflows run on Ubuntu runners and use the "anthropics/claude-code-action@beta" action with optional configuration parameters included but commented out. Changes
Estimated code review effort1 (~2 minutes) Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 @cameroncooke's task —— View job Code Review Complete ✅Todo List
Overall AssessmentThis PR adds two well-structured GitHub Actions workflows for Claude Code integration. Both files follow GitHub Actions best practices and are properly configured for their intended purposes. 📁 Files Reviewed
✅ Code Quality & Best PracticesStrengths:
Minor Improvements:
🔧 Configuration Analysisclaude-code-review.yml:
claude.yml:
🐛 Potential Issues & Recommendations
🔒 Security AssessmentExcellent Security Practices:
Security Notes:
⚡ Performance ConsiderationsOptimizations Present:
Performance Impact:
🧪 Test Coverage & ValidationCurrent State:
Recommendations:
🚀 Additional Recommendations
Final Verdict✅ Approved with Minor Suggestions This is a well-implemented addition that follows best practices. The workflows are properly configured, secure, and ready for production use. The suggested improvements are minor optimizations that can be addressed in future iterations. Key Strengths:
Priority Actions:
|
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: 1
🧹 Nitpick comments (4)
.github/workflows/claude.yml (2)
43-64: Clean up formatting issues.The YAML file has trailing spaces and an extra blank line that should be removed for consistency.
Apply this diff to fix the formatting issues:
additional_permissions: | actions: read - + # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) # model: "claude-opus-4-20250514" - + # Optional: Customize the trigger phrase (default: @claude) # trigger_phrase: "/claude" - + # Optional: Trigger when specific user is assigned to an issue # assignee_trigger: "claude-bot" - + # Optional: Allow Claude to run specific commands # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)" - + # Optional: Add custom instructions for Claude to customize its behavior for your project # custom_instructions: | # Follow our coding standards # Ensure all new code has tests # Use TypeScript for new files - + # Optional: Custom environment variables for Claude # claude_env: | # NODE_ENV: test -
43-64: Consider security implications of the allowed_tools configuration.The commented example shows various npm commands that would give Claude execution capabilities. Ensure that when enabled, the allowed commands are carefully vetted to prevent potential security issues.
When configuring
allowed_tools, consider:
- Limiting commands to read-only operations initially
- Avoiding commands that could modify system state
- Using specific command patterns rather than wildcards when possible
- Regularly reviewing and auditing enabled tools
.github/workflows/claude-code-review.yml (2)
54-77: Clean up formatting issues.Similar to the companion workflow, this file has trailing spaces that should be removed for consistency.
Apply this diff to fix the formatting issues:
# if: | # github.event.pull_request.user.login == 'external-contributor' || # github.event.pull_request.user.login == 'new-developer' || # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' - + runs-on: ubuntu-latest permissions: contents: read pull-requests: read issues: read id-token: write - + steps: - name: Checkout repository uses: actions/checkout@v4 # model: "claude-opus-4-20250514" - + # Direct prompt for automated review (no @claude mention needed) Be constructive and helpful in your feedback. - + # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR # use_sticky_comment: true - + # Optional: Customize review based on file types # - For tests: Coverage, edge cases, and test quality - + # Optional: Different prompts for different authors # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' || # 'Please provide a thorough code review focusing on our coding standards and best practices.' }} - + # Optional: Add specific tools for running tests or linting # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)" - + # Optional: Skip review for certain conditions # if: | # !contains(github.event.pull_request.title, '[skip-review]') && # !contains(github.event.pull_request.title, '[WIP]') -
71-72: Consider the security implications of allowed tools.Similar to the companion workflow, be cautious when enabling command execution capabilities. The example shows test and lint commands which are generally safer than build commands.
When configuring
allowed_toolsfor code review:
- Prefer read-only analysis tools (lint, typecheck)
- Test commands should be in isolated environments
- Avoid commands that could modify the codebase
- Consider using dedicated CI runners with restricted permissions
📜 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)
🪛 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)
🧰 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). (1)
- GitHub Check: claude-review
🔇 Additional comments (9)
.github/workflows/claude.yml (5)
1-11: Workflow structure and trigger configuration looks good.The workflow is properly structured with comprehensive event triggers covering all relevant GitHub events for Claude interaction. The trigger conditions appropriately cover issue comments, PR review comments, issues, and PR reviews.
15-19: Conditional logic is well-implemented.The if condition properly checks for the "@claude" trigger phrase across all supported event types and contexts. The logic correctly handles different event payloads and their respective body/title fields.
21-26: Permissions are appropriately scoped.The permissions follow the principle of least privilege while providing necessary access for Claude to function effectively. The
actions: readpermission is correctly documented as required for CI results access.
28-31: Checkout configuration is optimized.Using
fetch-depth: 1for shallow clone is appropriate for this workflow as Claude doesn't need full git history.
33-41: Claude action integration is correctly configured.The action setup uses the beta version and properly references the required OAuth token secret. The additional permissions configuration is correctly aligned with the job-level permissions.
.github/workflows/claude-code-review.yml (4)
1-12: Workflow configuration is well-structured.The workflow properly triggers on PR events and includes helpful commented examples for path-based filtering. The structure follows GitHub Actions best practices.
15-19: Author filtering logic is thoughtfully designed.The commented conditional logic shows good consideration for targeting specific user groups like external contributors and first-time contributors, which could be valuable for selective code review automation.
21-32: Runtime configuration follows best practices.The job configuration uses appropriate permissions and optimized checkout settings consistent with the companion workflow.
34-52: Review prompt is comprehensive and well-structured.The direct prompt covers all essential code review aspects including code quality, security, performance, and testing. The constructive tone guidance is appropriate.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Claude finished @cameroncooke's task —— View job Code Review Complete ✅ Todo List
Overall AssessmentThis PR adds two well-structured GitHub Actions workflows for Claude Code integration. Both files follow GitHub Actions best practices and are properly configured for their intended purposes. 📁 Files Reviewed
✅ Code Quality & Best PracticesStrengths:
Minor Improvements:
🔧 Configuration Analysisclaude-code-review.yml:
claude.yml:
🐛 Potential Issues & Recommendations
🔒 Security AssessmentExcellent Security Practices:
Security Notes:
⚡ Performance ConsiderationsOptimizations Present:
Performance Impact:
🧪 Test Coverage & ValidationCurrent State:
Recommendations:
🚀 Additional Recommendations
Final Verdict✅ Approved with Minor Suggestions This is a well-implemented addition that follows best practices. The workflows are properly configured, secure, and ready for production use. The suggested improvements are minor optimizations that can be addressed in future iterations. Key Strengths:
Priority Actions:
|
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: 0
🧹 Nitpick comments (2)
.github/workflows/claude-code-review.yml (2)
20-71: Remove trailing whitespace flagged by YAMLlintYAMLlint reports trailing-space errors on lines 20, 27, 42, 51, 56, 64, 68 and 71, plus one extra blank line at 76. While innocuous at run-time, these fail the linter and will break “required-checks” CI gates in many repos.
Please strip the whitespace and collapse the extra blank line.
22-27: Tightenpermissions; dropid-token: writeunless strictly requiredThe workflow grants
id-token: write, which enables OIDC token requests.
If the action does not callactions/github-scriptor another step that exchanges the OIDC token, this privilege is unnecessary. Reducing it toid-token: read(or removing it entirely) follows the principle of least privilege.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/claude-code-review.yml(1 hunks)
🪛 YAMLlint (1.37.1)
.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] 68-68: trailing spaces
(trailing-spaces)
[error] 71-71: trailing spaces
(trailing-spaces)
[warning] 76-76: too many blank lines (1 > 0)
(empty-lines)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.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] 68-68: trailing spaces
(trailing-spaces)
[error] 71-71: trailing spaces
(trailing-spaces)
[warning] 76-76: 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). (1)
- GitHub Check: claude-review
🔇 Additional comments (2)
.github/workflows/claude-code-review.yml (2)
38-39: Verify secret name & availability
claude_code_oauth_tokenmust exist in the repo’s secrets for the job to start; otherwise the workflow will silently fail during parameter expansion. Double-check that the secret is defined in Settings ▸ Secrets and variables ▸ Actions before merging.
65-67: Commented conditional is now syntactically valid 👍The previously-flagged broken multi-line expression has been consolidated into a single commented line, which resolves the YAML syntax issue.
🤖 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