-
Notifications
You must be signed in to change notification settings - Fork 0
Add Claude Code GitHub Workflow #18
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. |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds two GitHub Actions workflows that invoke an external Claude code-review action: one triggers on pull request events for automated PR reviews with plugin configuration; the other triggers on comments/reviews mentioning Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub as GitHub Events
participant Actions as GitHub Actions Runner
participant Repo as Repository (checkout)
participant ClaudeAction as anthropics/claude-code-action
participant ClaudeAPI as Claude Service
rect rgba(100,150,240,0.5)
GitHub->>Actions: PR event or comment triggers workflow
end
Actions->>Repo: checkout repository
Actions->>ClaudeAction: invoke action with OAuth token + config
ClaudeAction->>ClaudeAPI: send prompt + plugin spec
ClaudeAPI-->>ClaudeAction: return review/response
ClaudeAction-->>Actions: output results (comment, review, etc.)
Actions->>GitHub: post comment or update PR/review
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. 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.
Pull request overview
Adds GitHub Actions workflows to integrate Claude Code into the repository for interactive (“@claude”-triggered) runs and automated PR code reviews.
Changes:
- Introduces an “@claude”-triggered workflow for issues, PR comments, and reviews.
- Adds an automated “Claude Code Review” workflow that runs on PR lifecycle events.
- Configures the Anthropic Claude Code action with repository checkout and minimal permissions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
.github/workflows/claude.yml |
Workflow to run Claude Code when “@claude” is detected in issue/PR comment/review content. |
.github/workflows/claude-code-review.yml |
Workflow to run a code review plugin automatically on PR open/sync-related events. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write | ||
|
|
Copilot
AI
Jan 25, 2026
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.
On pull_request events from forks, repository secrets (including CLAUDE_CODE_OAUTH_TOKEN) are not provided, so this job will fail on forked PRs. Add a guard to skip when the secret isn’t available and/or when github.event.pull_request.head.repo.full_name != github.repository to prevent noisy failures.
| pull-requests: read | ||
| issues: read |
Copilot
AI
Jan 25, 2026
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 workflow’s token permissions are read-only for pull-requests and issues. If the code-review plugin is expected to leave review comments/status on the PR, it will need corresponding write permissions; otherwise the review results may only be visible in Actions logs. Confirm the intended behavior and adjust permissions accordingly.
| pull-requests: read | |
| issues: read | |
| pull-requests: write | |
| issues: write |
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 |
Copilot
AI
Jan 25, 2026
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.
Repository workflows consistently use actions/checkout@v6 (e.g., .github/workflows/version-check.yml:12). To keep checkout pinned consistently across CI, consider updating this workflow to the same major version.
| (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'))) |
Copilot
AI
Jan 25, 2026
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.
The job can currently be triggered by anyone who can open an issue or leave a comment containing “@claude”. That means external users could run this workflow and consume the CLAUDE_CODE_OAUTH_TOKEN secret. Add an author/actor trust check (e.g., comment/issue/review author_association in OWNER|MEMBER|COLLABORATOR, or an allowlist) to each branch of the if condition and/or remove the issues trigger if not needed.
| (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.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'COLLABORATOR') | |
| ) || | |
| ( | |
| github.event_name == 'pull_request_review_comment' && | |
| contains(github.event.comment.body, '@claude') && | |
| (github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'COLLABORATOR') | |
| ) || | |
| ( | |
| github.event_name == 'pull_request_review' && | |
| contains(github.event.review.body, '@claude') && | |
| (github.event.review.author_association == 'OWNER' || | |
| github.event.review.author_association == 'MEMBER' || | |
| github.event.review.author_association == 'COLLABORATOR') | |
| ) || | |
| ( | |
| github.event_name == 'issues' && | |
| (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) && | |
| (github.event.issue.author_association == 'OWNER' || | |
| github.event.issue.author_association == 'MEMBER' || | |
| github.event.issue.author_association == 'COLLABORATOR') | |
| ) |
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issues: | ||
| types: [opened, assigned] | ||
| pull_request_review: | ||
| types: [submitted] |
Copilot
AI
Jan 25, 2026
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.
PR description says the workflow runs when @claude is mentioned in PR/issue comments, but this workflow also triggers on issues (opened/assigned) and pull_request_review (submitted). Either align the triggers with the described behavior or update the PR description to reflect these additional trigger paths.
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write | ||
| actions: read # Required for Claude to read CI results on PRs |
Copilot
AI
Jan 25, 2026
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.
The workflow permissions are read-only for issues and pull-requests, but the PR description claims Claude can “create comments, branches, and commits.” With the current GITHUB_TOKEN permissions, posting comments or pushing commits from this workflow won’t be possible. Either grant the required write permissions (least-privilege) or adjust the description/expectations.
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 |
Copilot
AI
Jan 25, 2026
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.
Repository workflows consistently use actions/checkout@v6 (e.g., .github/workflows/aot-publish.yml:16, nuget-publish.yml:22). To match the repo’s established version pinning, update this workflow to use the same checkout major version.
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, ready_for_review, reopened] | ||
| # Optional: Only run on specific file changes |
Copilot
AI
Jan 25, 2026
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 workflow runs on every PR open/sync/reopen event, but the PR description focuses on “mention @claude” to trigger. If always-on reviews are intended, the description should mention it; otherwise consider adding an explicit opt-in (label, comment command, or path filter) to avoid unexpected/expensive runs.
The workflow had read-only permissions which prevented Claude from posting comments and making changes. Updated contents, pull-requests, and issues permissions to write. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 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
✏️ Tip: You can customize this high-level summary in your review settings.