-
Notifications
You must be signed in to change notification settings - Fork 1
Add Claude Code GitHub Workflow #44
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
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
📝 WalkthroughWalkthroughA new GitHub Actions workflow named "Claude Code" has been introduced. This workflow triggers on specific GitHub events involving comments, issues, and pull request reviews that mention "@claude". It checks out the repository and runs the "anthropics/claude-code-action@beta" action using an Anthropic API key from repository secrets. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub User
participant GitHub Actions
participant Claude Code Action
GitHub User->>GitHub Actions: Create comment/issue/PR with "@claude"
GitHub Actions->>Claude Code Action: Trigger workflow, checkout repo, run action
Claude Code Action->>GitHub Actions: Process request using Anthropic API key
GitHub Actions->>GitHub User: Respond with action results
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. 🪧 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
Documentation and Community
|
|
Changelog updates: 🔄 2025-05-23 *Added
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
Manual-approval option for PR-Agent is disabled. You can enable it via a configuration file |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #44 +/- ##
=========================================
Coverage 98.80% 98.80%
Complexity 26 26
=========================================
Files 1 1
Lines 84 84
=========================================
Hits 83 83
Misses 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR adds a GitHub Actions workflow to integrate Claude Code into the repository, enabling automated responses and code reviews via @claude mentions.
- Adds a new workflow file (.github/workflows/claude.yml) that triggers on various GitHub events when @claude is mentioned.
- Configures secure usage of the Anthropic API key and restricts workflow execution to users with write access.
CI Feedback 🧐(Feedback updated until commit 26dbdca)A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
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 (2)
.github/workflows/claude.yml (2)
1-12: Well-defined workflow triggers
You’ve covered core events (issue comments, PR review comments, issues opened/assigned, PR reviews). Consider adding aworkflow_dispatchtrigger for manual runs and easier testing without a real comment.
32-37: Verify secret configuration and rotation
Ensure thatANTHROPIC_API_KEYis added under repository secrets and has a rotation policy. Optionally, you could expose it via anenv:block for clarity:env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/claude.yml(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: guardrails/scan
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
.github/workflows/claude.yml (1)
27-31: Checkout step is good
Usingactions/checkout@v4withfetch-depth: 1ensures speed and minimal history. If Claude ever needs deeper context, you can adjust or removefetch-depth, but this setup is solid.
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write |
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.
Grant write permissions for repository changes
The action needs to create branches, commits, and comments, but you’ve limited contents, issues, and pull-requests to read-only. Update the permissions block to include write access:
permissions:
contents: write
issues: write
pull-requests: write
id-token: write🤖 Prompt for AI Agents
In .github/workflows/claude.yml around lines 21 to 25, the permissions for
contents, issues, and pull-requests are set to read-only, but the action
requires write access to create branches, commits, and comments. Update the
permissions block to set contents, issues, and pull-requests to write instead of
read, while keeping id-token as write.
| 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'))) | ||
| runs-on: ubuntu-latest |
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.
🛠️ Refactor suggestion
Enforce author_association checks for security
Per the PR objectives, only users with write access should trigger Claude. Right now any mention of @claude fires the job. Enhance the if condition to also verify author_association (e.g. OWNER / MEMBER / COLLABORATOR) on github.event.comment.author_association, github.event.issue.author_association, and github.event.review.user.association to block untrusted actors.
🤖 Prompt for AI Agents
In .github/workflows/claude.yml around lines 15 to 20, the current if condition
triggers the job on any mention of '@claude' without checking the author's
association, which can allow untrusted users to run the job. Update the if
condition to include checks that the author_association is one of OWNER, MEMBER,
or COLLABORATOR by verifying github.event.comment.author_association,
github.event.issue.author_association, and github.event.review.user.association
accordingly. This will restrict triggering to trusted users only.
User description
🤖 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 documentation.
After merging this PR, let's try mentioning @claude in a comment on any PR to get started!
PR Type
enhancement, other
Description
Add GitHub Actions workflow to enable Claude Code integration
Trigger workflow on @claude mentions in issues, PRs, and comments
Securely use Anthropic API key from GitHub secrets
Restrict workflow execution to users with write access
Changes walkthrough 📝
claude.yml
Add Claude Code GitHub Actions workflow.github/workflows/claude.yml
Summary by CodeRabbit