Skip to content

Add claude GitHub actions 1750851707500#3

Closed
arika0093 wants to merge 4 commits into
mainfrom
add-claude-github-actions-1750851707500
Closed

Add claude GitHub actions 1750851707500#3
arika0093 wants to merge 4 commits into
mainfrom
add-claude-github-actions-1750851707500

Conversation

@arika0093

@arika0093 arika0093 commented Jun 25, 2025

Copy link
Copy Markdown
Owner

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

  • New Features
    • Introduced automated AI-powered code review for pull requests using Claude, providing feedback on code quality, bugs, performance, security, and test coverage.
    • Enabled Claude AI assistant to respond to "@claude" mentions in issue comments, pull request reviews, and issues, facilitating interactive AI support within GitHub workflows.

@coderabbitai

coderabbitai Bot commented Jun 25, 2025

Copy link
Copy Markdown

Walkthrough

Two 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 anthropics/claude-code-action@beta action and provide flexible configuration options.

Changes

File(s) Change Summary
.github/workflows/claude-code-review.yml Added workflow for automated AI code review on pull requests using Claude.
.github/workflows/claude.yml Added workflow to trigger Claude AI responses to "@claude" mentions in issues, comments, and reviews.

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
Loading

Poem

In the warren of code, two new friends appear,
Claude hops in when pull requests draw near.
Mention "@claude," and watch answers bloom,
AI reviews and replies now light up the room.
With every merge and comment, delight multiplies—
The cleverest rabbit, with Claude, now replies!
🐇✨


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (3)
.github/workflows/claude-code-review.yml (1)

3-10: Consider a concurrency group to avoid duplicated reviews on force-pushes

If 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 triggers

Because 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-lint

Nine 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

📥 Commits

Reviewing files that changed from the base of the PR and between 71d63e5 and 0cc8ad1.

📒 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 lines

While harmless to GitHub Actions, these extra spaces trigger CI linters and pollute diffs. Strip them to keep the workflow file clean.

[ suggest_nitpick ]

Comment thread .github/workflows/claude-code-review.yml
Comment thread .github/workflows/claude.yml
@claude

claude Bot commented Jun 25, 2025

Copy link
Copy Markdown

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

claude Bot commented Jun 25, 2025

Copy link
Copy Markdown

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

claude Bot commented Jun 25, 2025

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (4)
.github/workflows/claude-code-review.yml (2)

20-76: Remove trailing whitespace & extra blank line to satisfy YAML linters.
Multiple lines are failing yamllint (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-files or yamllint locally to catch these early.


3-9: Consider handling reopened / ready_for_review PR 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.
Same yamllint warnings 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: add concurrency to prevent duplicate runs.
If two comments containing @claude are 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0cc8ad1 and ee2996d.

📒 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: write resolves the blocker flagged in the earlier review.

.github/workflows/claude.yml (1)

21-25: Write scopes added – bot can now reply.
pull-requests: write and issues: write satisfy the requirement noted previously.

@arika0093 arika0093 closed this Jun 25, 2025
@arika0093 arika0093 deleted the add-claude-github-actions-1750851707500 branch June 25, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant