Add Claude Code GitHub Workflow#1
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo new GitHub Actions workflows integrated Claude AI code review into pull request and comment-based triggers. The workflows invoke the Claude Code action with OAuth authentication to provide automated code review capabilities upon PR events and Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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.
Pull request overview
Adds GitHub Actions workflows to integrate the Anthropic Claude Code GitHub Action into the repo, enabling automated agent runs either via @claude mentions or PR-triggered code review runs.
Changes:
- Added a comment-/issue-/review-triggered workflow that runs when
@claudeis mentioned. - Added an always-on PR workflow intended to run an automated Claude-based code review.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/claude.yml |
Adds an @claude-mention-triggered Claude Code workflow for issues/comments/reviews. |
.github/workflows/claude-code-review.yml |
Adds a PR-event-triggered Claude Code “code review” workflow using a review plugin. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, ready_for_review, reopened] | ||
| # Optional: Only run on specific file changes |
There was a problem hiding this comment.
PR description says the Claude workflow “runs automatically whenever Claude is mentioned in PR or issue comments”, but this workflow is triggered unconditionally on PR lifecycle events (opened/synchronize/ready_for_review/reopened) and doesn’t look for an @claude mention. Either update the PR description to reflect the always-on PR review behavior, or add filtering (if/paths/author filters) so it matches the described trigger model.
| (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.
The job-level if only checks for an @claude mention, so anyone who can open an issue or comment (including external users) can trigger this workflow and consume the CLAUDE_CODE_OAUTH_TOKEN secret. This contradicts the PR description (“Only users with write access … can trigger the workflow”) and is a security/cost-control risk. Add an authorization gate to the if (e.g., restrict to trusted author_association values and/or query the repo collaborator permission via the GitHub API) before invoking the action.
| (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') && | |
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) | |
| ) || | |
| ( | |
| github.event_name == 'pull_request_review_comment' && | |
| contains(github.event.comment.body, '@claude') && | |
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) | |
| ) || | |
| ( | |
| github.event_name == 'pull_request_review' && | |
| contains(github.event.review.body, '@claude') && | |
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.review.author_association) | |
| ) || | |
| ( | |
| github.event_name == 'issues' && | |
| ( | |
| contains(github.event.issue.body, '@claude') || | |
| contains(github.event.issue.title, '@claude') | |
| ) && | |
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association) | |
| ) |
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, ready_for_review, reopened] | ||
| # Optional: Only run on specific file changes |
There was a problem hiding this comment.
This workflow runs on every PR open/sync/etc, but it requires secrets.CLAUDE_CODE_OAUTH_TOKEN. For PRs from forks, GitHub won’t provide repository secrets to pull_request workflows, so this will reliably fail (and may create a failing required check). Add a job if to skip forked PRs (e.g., github.event.pull_request.head.repo.full_name == github.repository) or switch to pull_request_target with appropriate hardening if you intend to support forks.
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