Add claude GitHub actions 1750851707500#3
Conversation
WalkthroughTwo new GitHub Actions workflows were introduced: one for automated AI code review on pull requests using the Claude model, and another for responding to "@claude" mentions in issues, comments, and reviews. Both workflows utilize the Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub
participant Workflow
participant Claude Action
GitHub->>Workflow: PR opened/synchronized OR "@claude" mentioned
Workflow->>Claude Action: Checkout repo and invoke Claude
Claude Action->>GitHub: Post review or response as comment
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 (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
.github/workflows/claude-code-review.yml (1)
3-10: Consider a concurrency group to avoid duplicated reviews on force-pushesIf a contributor pushes several times in quick succession, multiple review jobs will run in parallel and the bot may spam the PR. A small concurrency stanza keeps only the latest run:
concurrency: group: claude-review-${{ github.event.pull_request.number }} cancel-in-progress: true.github/workflows/claude.yml (2)
13-20: Add a concurrency group to prevent race conditions on multi-event triggersBecause the job can be triggered by comments, reviews and issues, simultaneous jobs are likely. A concurrency block will ensure only one Claude response is posted:
concurrency: group: claude-interaction-${{ github.run_id }} cancel-in-progress: true
37-55: Trailing spaces & extra blank line flagged by YAML-lintNine lines contain trailing whitespace and there’s an extra blank line at 59. Remove them to make the workflow pass basic lint checks.
📜 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-code-review.yml
[error] 20-20: trailing spaces
(trailing-spaces)
[error] 27-27: trailing spaces
(trailing-spaces)
[error] 39-39: trailing spaces
(trailing-spaces)
[error] 42-42: trailing spaces
(trailing-spaces)
[error] 51-51: trailing spaces
(trailing-spaces)
[error] 53-53: trailing spaces
(trailing-spaces)
[error] 61-61: 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)
[warning] 75-75: too many blank lines
(1 > 0) (empty-lines)
.github/workflows/claude.yml
[error] 37-37: trailing spaces
(trailing-spaces)
[error] 40-40: trailing spaces
(trailing-spaces)
[error] 43-43: trailing spaces
(trailing-spaces)
[error] 46-46: trailing spaces
(trailing-spaces)
[error] 49-49: trailing spaces
(trailing-spaces)
[error] 55-55: trailing spaces
(trailing-spaces)
[warning] 59-59: too many blank lines
(1 > 0) (empty-lines)
🔇 Additional comments (1)
.github/workflows/claude-code-review.yml (1)
20-70: YAML-lint flags trailing whitespace on 9 separate linesWhile harmless to GitHub Actions, these extra spaces trigger CI linters and pollute diffs. Strip them to keep the workflow file clean.
[ suggest_nitpick ]
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
.github/workflows/claude-code-review.yml (2)
20-76: Remove trailing whitespace & extra blank line to satisfy YAML linters.
Multiple lines are failingyamllint(trailing-spaces,empty-lines). This is purely cosmetic but breaks CI in strict repos.- pull_request.user.login == 'FIRST_TIME_CONTRIBUTOR' - + pull_request.user.login == 'FIRST_TIME_CONTRIBUTOR' ... - id-token: write - + id-token: write ... - with: - fetch-depth: 1 + with: + fetch-depth: 1 ... - Be constructive and helpful in your feedback. - + Be constructive and helpful in your feedback. ... - # !contains(github.event.pull_request.title, '[WIP]') - + # !contains(github.event.pull_request.title, '[WIP]')Run
pre-commit run --all-filesoryamllintlocally to catch these early.
3-9: Consider handlingreopened/ready_for_reviewPR events.
If a draft PR becomes ready or a closed PR is reopened, the review won’t trigger. Add them if you want every visible change covered:- pull_request: - types: [opened, synchronize] + pull_request: + types: [opened, synchronize, reopened, ready_for_review].github/workflows/claude.yml (2)
37-60: Strip trailing whitespace & final blank line.
Sameyamllintwarnings as the other workflow. Quick tidy keeps CI green.- anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} ... - # NODE_ENV: test - + # NODE_ENV: test
13-20: Race-condition guard: addconcurrencyto prevent duplicate runs.
If two comments containing@claudeare posted seconds apart, you may spawn parallel jobs that both race to respond. Add a concurrency group keyed on the comment ID to serialise:claude: concurrency: group: claude-${{ github.event_name }}-${{ github.event.issue?.id || github.event.comment.id }} cancel-in-progress: false
📜 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-code-review.yml
[error] 20-20: trailing spaces
(trailing-spaces)
[error] 27-27: trailing spaces
(trailing-spaces)
[error] 39-39: trailing spaces
(trailing-spaces)
[error] 42-42: trailing spaces
(trailing-spaces)
[error] 51-51: trailing spaces
(trailing-spaces)
[error] 53-53: trailing spaces
(trailing-spaces)
[error] 61-61: 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)
[warning] 75-75: too many blank lines
(1 > 0) (empty-lines)
.github/workflows/claude.yml
[error] 37-37: trailing spaces
(trailing-spaces)
[error] 40-40: trailing spaces
(trailing-spaces)
[error] 43-43: trailing spaces
(trailing-spaces)
[error] 46-46: trailing spaces
(trailing-spaces)
[error] 49-49: trailing spaces
(trailing-spaces)
[error] 55-55: trailing spaces
(trailing-spaces)
[warning] 59-59: too many blank lines
(1 > 0) (empty-lines)
🔇 Additional comments (2)
.github/workflows/claude-code-review.yml (1)
22-26: Permissions fix confirmed – workflow can now comment on PRs.
pull-requests: write/issues: writeresolves the blocker flagged in the earlier review..github/workflows/claude.yml (1)
21-25: Write scopes added – bot can now reply.
pull-requests: writeandissues: writesatisfy the requirement noted previously.
This pull request introduces two new GitHub Actions workflows to integrate Claude AI for automated code review and other interactions. The workflows aim to streamline code review processes and enable Claude to respond to specific triggers in issues and pull requests.
New GitHub Actions workflows:
Automated code review:
.github/workflows/claude-code-review.yml: Adds a workflow named "Claude Code Review" that automatically reviews pull requests when opened or synchronized. It uses Claude AI to provide feedback on code quality, potential bugs, performance, security, and test coverage. The workflow includes customizable prompts and filters for specific file types, authors, or conditions.Interaction triggers for Claude:
.github/workflows/claude.yml: Adds a workflow named "Claude Code" that triggers Claude AI when specific phrases (e.g.,@claude) are mentioned in issue comments, pull request review comments, or issue titles and bodies. It allows customization of trigger phrases, tools, and instructions to adapt Claude's behavior for the project.Summary by CodeRabbit