Skip to content

Conversation

taka-oyama
Copy link
Collaborator

No description provided.

@taka-oyama taka-oyama requested a review from a team July 2, 2025 09:15
@taka-oyama taka-oyama self-assigned this Jul 2, 2025
@Copilot Copilot AI review requested due to automatic review settings July 2, 2025 09:15
@taka-oyama taka-oyama added the enhancement New feature or request label Jul 2, 2025
Copy link

coderabbitai bot commented Jul 2, 2025

Walkthrough

A new GitHub Actions workflow file named claude.yml has been added under .github/workflows. This workflow is triggered by several GitHub events, including issue comments, pull request review comments, issue openings or assignments, and pull request review submissions. The workflow runs a job called claude-code-action only if the event's comment or issue body includes the mention "@claude". The job executes on an Ubuntu runner, checks out the repository with a shallow clone, and invokes the anthropics/claude-code-action@beta action using a repository secret for the API key, a 60-minute timeout, and restricted Bash command tools for PHP and Composer.


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.

Copy link

@Copilot Copilot AI left a 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 a new GitHub Actions workflow to run the Claude PR Assistant when @claude is mentioned in various comment and review contexts.

  • Introduces a .github/workflows/claude.yml file defining triggers for issue comments, review comments, review submissions, and issue openings/assignments.
  • Defines a job claude-code-action that runs only when @claude is detected and calls the anthropics/claude-code-action@beta.
  • Configures repository permissions and action inputs (API key, timeout, allowed tools).
Comments suppressed due to low confidence (3)

.github/workflows/claude.yml:24

  • The action needs write permissions to post comments on issues and pull requests. Change issues: read to issues: write and pull-requests: read to pull-requests: write.
      issues: read

.github/workflows/claude.yml:15

  • [nitpick] Using YAML literal (|) preserves newlines in the if expression. Consider using a folded scalar (>) to collapse lines into a single expression for clarity.
    if: |

.github/workflows/claude.yml:3

  • To catch @claude mentions in pull request descriptions, add a pull_request trigger (e.g., pull_request: types: [opened, edited, reopened]).
on:

@taka-oyama
Copy link
Collaborator Author

@yamadashy

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/claude.yml (2)

16-19: Filter is case-sensitive; variants such as “@claude” won’t trigger

contains() performs a case-sensitive match, so users typing “@claude”, “@claude”, etc. won’t start the workflow. If that flexibility is desired, duplicate the predicates or switch to a regex-based helper, e.g.:

if: >
  (github.event_name == 'issue_comment' &&
   (contains(github.event.comment.body, '@claude') ||
    contains(github.event.comment.body, '@Claude')))
  # …repeat for the other branches

33-34: Pin the action to a commit SHA instead of the moving beta tag

For supply-chain security and reproducibility, reference a specific commit or semver tag.

-        uses: anthropics/claude-code-action@beta
+        uses: anthropics/claude-code-action@<commit-sha>

Replace <commit-sha> with the latest trusted SHA from the action’s repository.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76ded83 and d4cd730.

📒 Files selected for processing (1)
  • .github/workflows/claude.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Run-PHPUnit

Comment on lines +21 to +25
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
Copy link

@coderabbitai coderabbitai bot Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Action will be unable to post comments with read-only permissions

The anthropics/claude-code-action must create comments on issues / PRs. With only read scopes for issues and pull-requests, the job will fail when it tries to write. Grant write access explicitly (GitHub defaults to read if omitted).

       contents: read
-      pull-requests: read
-      issues: read
+      pull-requests: write
+      issues: write
       id-token: write
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
🤖 Prompt for AI Agents
In .github/workflows/claude.yml around lines 21 to 25, the permissions for
issues and pull-requests are set to read-only, which prevents the action from
posting comments. Change the permissions for both issues and pull-requests from
read to write to allow the action to create comments on issues and PRs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments are posted using the App token

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yamadashy Thank you for the clarification! You're absolutely right - since the anthropics/claude-code-action uses an App token (via the anthropic_api_key secret) for authentication, it doesn't rely on the workflow's GITHUB_TOKEN permissions for posting comments. The read-only permissions for issues and pull-requests are indeed sufficient in this case.


✏️ Learnings added
Learnt from: yamadashy
PR: colopl/laravel-spanner#287
File: .github/workflows/claude.yml:21-25
Timestamp: 2025-07-02T10:16:52.902Z
Learning: The anthropics/claude-code-action uses App token authentication (via anthropic_api_key secret) to post comments, so it doesn't require write permissions for issues and pull-requests in the GitHub workflow permissions. The workflow can have read-only permissions since the action uses its own authentication method.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@taka-oyama taka-oyama merged commit a18d5b8 into master Jul 4, 2025
7 of 8 checks passed
@taka-oyama taka-oyama deleted the feature/add-claude branch July 4, 2025 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants