-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add claude code action #287
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
WalkthroughA new GitHub Actions workflow file named 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.
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 theanthropics/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
toissues: write
andpull-requests: read
topull-requests: write
.
issues: read
.github/workflows/claude.yml:15
- [nitpick] Using YAML literal (
|
) preserves newlines in theif
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 apull_request
trigger (e.g.,pull_request: types: [opened, edited, reopened]
).
on:
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.
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 movingbeta
tagFor 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
📒 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
permissions: | ||
contents: read | ||
pull-requests: read | ||
issues: read | ||
id-token: write |
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.
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.
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.
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.
Comments are posted using the App token
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.
@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.
No description provided.