Skip to content

claude code integration#207

Merged
rodrigo-leal-usercentrics merged 3 commits into
masterfrom
feature/claude-github--integration
Apr 23, 2026
Merged

claude code integration#207
rodrigo-leal-usercentrics merged 3 commits into
masterfrom
feature/claude-github--integration

Conversation

@rodrigo-leal-usercentrics
Copy link
Copy Markdown
Collaborator

@rodrigo-leal-usercentrics rodrigo-leal-usercentrics commented Apr 21, 2026

User description

Summary by CodeRabbit

  • New Features
    • Claude Code automation is now integrated into the repository. Trigger it by mentioning @claude in pull request comments, code reviews, or issues.

CodeAnt-AI Description

Add Claude Code responses to PR discussions

What Changed

  • Mentioning @claude in PR review comments, review submissions, or PR conversation comments now starts Claude Code
  • Only repository owners, members, and collaborators can trigger it
  • Issue comments only count when they belong to a pull request thread

Impact

✅ Faster PR follow-up
✅ Fewer unwanted AI runs
✅ Safer public-repo automation

🔄 Retrigger CodeAnt AI Review

Details

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 21, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Add Claude Code GitHub Actions workflow integration

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Adds GitHub Actions workflow for Claude Code integration
• Triggers on issue comments, PR reviews, and issue events
• Automatically invokes Claude Code action when @claude mentioned
• Includes optional configuration for customization and permissions
Diagram
flowchart LR
  GH["GitHub Events<br/>issue_comment, PR review, issues"]
  TRIGGER["@claude trigger<br/>detection"]
  ACTION["Claude Code<br/>Action"]
  PERMS["Permissions<br/>contents, PRs, issues"]
  GH -- "event filters" --> TRIGGER
  TRIGGER -- "if condition met" --> ACTION
  PERMS -- "grants access" --> ACTION
Loading

Grey Divider

File Changes

1. .github/workflows/claude.yml ⚙️ Configuration changes +58/-0

GitHub Actions workflow for Claude Code integration

• Creates new GitHub Actions workflow triggered by issue comments, PR review comments, and issue
 events
• Implements conditional logic to detect @claude mentions in comments, reviews, and issue
 bodies/titles
• Configures Claude Code action with API key authentication and necessary permissions
• Includes commented-out optional configuration examples for trigger phrases, assignee triggers, and
 CLI arguments

.github/workflows/claude.yml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 21, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Untrusted trigger with secrets🐞 Bug ⛨ Security
Description
The workflow can be triggered by any issue/PR commenter who includes "@claude", but it runs a
third-party action with a repository secret and write-scoped permissions. This enables untrusted
users (anyone who can comment) to invoke a privileged automation path and attempt prompt-driven
misuse/exfiltration or repository modification via the job’s credentials.
Code

.github/workflows/claude.yml[R3-37]

+on:
+  issue_comment:
+    types: [created]
+  pull_request_review_comment:
+    types: [created]
+  issues:
+    types: [opened, assigned]
+  pull_request_review:
+    types: [submitted]
+
+jobs:
+  claude:
+    if: |
+      (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')))
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+      pull-requests: write
+      issues: write
+      id-token: write
+      actions: read # Required for Claude to read CI results on PRs
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v6
+        with:
+          fetch-depth: 1
+
+      - name: Run Claude Code
+        id: claude
+        uses: anthropics/claude-code-action@v1
+        with:
+          anthropic_api_key: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
Evidence
The workflow is triggered on comment/review/issue events and the only gate is a substring check for
“@claude”, with no actor/association allowlist. The job then grants write permissions and passes a
repository secret into a third-party action, so any eligible commenter can cause a privileged,
secret-bearing run.

.github/workflows/claude.yml[3-19]
.github/workflows/claude.yml[21-26]
.github/workflows/claude.yml[33-37]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow executes on untrusted user input (any comment containing `@claude`) while injecting `secrets.CLAUDE_CODE_OAUTH_TOKEN` and granting write permissions. This allows any commenter to trigger a privileged run.
### Issue Context
This job runs on `issue_comment`, `pull_request_review_comment`, `pull_request_review`, and `issues` events and only checks for `contains(..., '@claude')`.
### Fix Focus Areas
- Add an authorization gate (e.g., allowlist `github.actor` or require `author_association` in `['OWNER','MEMBER','COLLABORATOR']`) in the job `if:` so only trusted users can trigger.
- Optionally restrict `issue_comment` runs to PR comments only (`github.event.issue.pull_request != null`) if issue triggers aren’t required.
- Consider splitting into two jobs: an untrusted “router” job with no secrets/low perms that decides whether to run a trusted job.
- .github/workflows/claude.yml[3-37]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Overbroad job permissions🐞 Bug ⛨ Security
Description
The job grants contents: write, pull-requests: write, issues: write, and id-token: write for
every run, increasing the impact of any misuse/compromise. These permissions allow repository
modification and OIDC token minting even if not strictly required for the workflow’s core behavior.
Code

.github/workflows/claude.yml[R21-26]

+    permissions:
+      contents: write
+      pull-requests: write
+      issues: write
+      id-token: write
+      actions: read # Required for Claude to read CI results on PRs
Evidence
The permissions are set at the job level, so every triggered run receives broad write scopes plus
id-token: write. Combined with the workflow’s external action usage, this amplifies the blast
radius of any abuse.

.github/workflows/claude.yml[21-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Job-level permissions are broader than necessary, increasing the blast radius of a compromised/misused workflow.
### Issue Context
The workflow is event-driven from comments/issues and runs a third-party action; least-privilege is important.
### Fix Focus Areas
- Remove `id-token: write` unless the workflow explicitly needs OIDC.
- Prefer `contents: read` unless the workflow must push commits.
- Only keep `pull-requests: write` / `issues: write` if the action needs to comment/update PRs/issues.
- .github/workflows/claude.yml[21-26]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Actions not pinned 🐞 Bug ⛨ Security
Description
The workflow uses mutable version tags for actions (actions/checkout@v6,
anthropics/claude-code-action@v1), which can change over time and increases supply-chain risk. A
tag update (benign or malicious) would run new code automatically with this workflow’s granted
permissions.
Code

.github/workflows/claude.yml[R28-36]

+      - name: Checkout repository
+        uses: actions/checkout@v6
+        with:
+          fetch-depth: 1
+
+      - name: Run Claude Code
+        id: claude
+        uses: anthropics/claude-code-action@v1
+        with:
Evidence
Both actions are referenced by moving tags rather than immutable commit SHAs, so the executed code
can change without any repo-side diff or review.

.github/workflows/claude.yml[28-36]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Using tag-based action refs allows the executed action code to change without review, which is risky given the workflow’s permissions.
### Issue Context
The workflow currently references actions via `@v*` tags.
### Fix Focus Areas
- Replace `actions/checkout@v6` with a specific commit SHA (optionally keep a comment noting the intended version).
- Replace `anthropics/claude-code-action@v1` with a specific commit SHA.
- .github/workflows/claude.yml[28-36]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@rodrigo-leal-usercentrics has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 40 minutes and 39 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 40 minutes and 39 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a5e1feb0-e027-43df-bfbe-a4f8ac70f2e5

📥 Commits

Reviewing files that changed from the base of the PR and between 0c8656f and 73a6a21.

📒 Files selected for processing (1)
  • .github/workflows/claude.yml
📝 Walkthrough

Walkthrough

A new GitHub Actions workflow named "Claude Code" is added to automatically invoke Claude Code action on repository events (issue comments, pull request reviews, issues). The workflow triggers when @claude is mentioned and authenticates via OAuth token with appropriate repository and actions permissions.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/claude.yml
New workflow configuration that triggers Claude Code action on GitHub events (issue comments, PR review comments, issues, PR reviews) when @claude mention is detected. Includes commented options for customization (trigger phrase, assignee targeting, CLI arguments).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A rabbit hops in with a workflow so neat,
@claude is the trigger, the magic so sweet!
When issues arise and reviews come through,
Claude's here to help with suggestions brand new!
GitHub Actions dancing, automation's delight,
Code assistance flowing—thump thump—all night! 🌙✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'claude code integration' directly corresponds to the main change: adding a GitHub Actions workflow that integrates Claude Code via the anthropics/claude-code-action.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/claude-github--integration

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@pantoaibot
Copy link
Copy Markdown

pantoaibot Bot commented Apr 21, 2026

PR Summary:

Add GitHub Actions workflow to run Claude Code (anthropics/claude-code-action) when @claude is mentioned in issues, comments, or PR reviews.

  • New workflow: .github/workflows/claude.yml (job: claude).
  • Triggers: issue_comment (created), pull_request_review_comment (created), pull_request_review (submitted), issues (opened, assigned) — job guarded by an if() that checks for the '@claude' mention in comment/issue/PR review bodies or titles.
  • Steps: checkout repository (actions/checkout@v6) and run anthropics/claude-code-action@v1.
  • Inputs: anthropic_api_key sourced from secrets.CLAUDE_CODE_OAUTH_TOKEN.
  • Permissions: contents: write, pull-requests: write, issues: write, id-token: write, actions: read (allows Claude to read CI results on PRs).
  • Several optional/config commented examples included (custom trigger phrase, assignee trigger, claude_args, advanced settings).
  • Notes/impacts: no application code changes; requires adding the CLAUDE_CODE_OAUTH_TOKEN secret; action has write permissions to repo/PRs/issues — review and approve permissions/security before enabling.

Reviewed by Panto AI

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Apr 21, 2026
Comment thread .github/workflows/claude.yml
Comment thread .github/workflows/claude.yml
Comment thread .github/workflows/claude.yml Outdated
@pantoaibot
Copy link
Copy Markdown

pantoaibot Bot commented Apr 21, 2026

Reviewed up to commit:0c8656f3edb9d038328d59148cc710210635d1bd

Additional Suggestion
Others - Add concurrency and de-duplication (concurrency: group + cancel-in-progress) to avoid multiple overlapping runs for the same PR/issue and reduce rate usage. Also consider rate-limiting/debouncing triggers (e.g., only run on created, not edited, or require a short cooldown) to avoid excessive invocations from rapid comments/edits.
jobs:
  claude:
    concurrency:
      group: claude-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.issue.number || github.ref }}
      cancel-in-progress: true

Reviewed by Panto AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 21, 2026

CodeAnt AI finished reviewing your PR.

Copy link
Copy Markdown

@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: 3

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

49-49: Keep the commented install example deterministic.

Even as commented guidance, this encourages npm install in workflows. Use npm ci or yarn --frozen-lockfile in examples that may be copied into active workflow config.

As per coding guidelines, “Always use --frozen-lockfile (yarn) or npm ci (npm) for deterministic dependency installs in workflows”.

♻️ Proposed example update
-          #   --allowedTools "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
+          #   --allowedTools "Bash(npm ci),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude.yml at line 49, Update the commented install
example so it uses deterministic installs: replace the "npm install" token in
the commented tools string (the line containing "--allowedTools \"Bash(npm
install),...\"") with "npm ci" (or use "yarn --frozen-lockfile" if yarn is
preferred) so the example encourages deterministic dependency installation in CI
workflows.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/claude.yml:
- Around line 26-37: The workflow step using anthropics/claude-code-action@v1
(step id: claude, name: Run Claude Code) is passing the wrong input and missing
permissions; change the input key from anthropic_api_key to
claude_code_oauth_token to wire the OAuth secret correctly and add an
additional_permissions input set to actions: read so the action can access CI
results. Ensure you keep the same step id/name and only replace the input key
and add the additional_permissions field.
- Around line 29-35: The workflow uses mutable tags actions/checkout@v6 and
anthropics/claude-code-action@v1; replace those tag references with their
corresponding full 40-character commit SHAs to pin the actions immutably (e.g.,
change uses: actions/checkout@v6 -> uses: actions/checkout@<full-commit-sha> and
uses: anthropics/claude-code-action@v1 -> uses:
anthropics/claude-code-action@<full-commit-sha>), then verify the SHAs point to
the intended release commits and run the workflow to ensure no behavioural
changes.
- Around line 15-26: Add an author_association gate to the job condition so only
trusted users can trigger the workflow (check the existing if: condition and
require e.g. github.event.comment.author_association to be one of OWNER, MEMBER,
COLLABORATOR before granting permissions), replace the two action refs
actions/checkout@v6 and anthropics/claude-code-action@v1 with their pinned full
commit SHAs, and ensure the secret CLAUDE_CODE_OAUTH_TOKEN is only exposed when
the author_association check passes; also remove or fix the commented Bash
example that uses `npm install` (change to `npm ci` or remove the comment) to
comply with deterministic install guidelines.

---

Nitpick comments:
In @.github/workflows/claude.yml:
- Line 49: Update the commented install example so it uses deterministic
installs: replace the "npm install" token in the commented tools string (the
line containing "--allowedTools \"Bash(npm install),...\"") with "npm ci" (or
use "yarn --frozen-lockfile" if yarn is preferred) so the example encourages
deterministic dependency installation in CI workflows.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 56f27008-b4b5-4967-bebd-2a695257846b

📥 Commits

Reviewing files that changed from the base of the PR and between f8ddd2e and 0c8656f.

📒 Files selected for processing (1)
  • .github/workflows/claude.yml

Comment thread .github/workflows/claude.yml
Comment thread .github/workflows/claude.yml
Comment thread .github/workflows/claude.yml
Comment thread .github/workflows/claude.yml
Comment thread .github/workflows/claude.yml
Configures claude-code-action to respond to @claude mentions on PR
review comments and reviews, restricted to repo members/collaborators.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Filters issue_comment to only fire on PR conversation threads
(github.event.issue.pull_request != null), not on issue comments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rodrigo-leal-usercentrics rodrigo-leal-usercentrics merged commit 0153c9e into master Apr 23, 2026
9 of 11 checks passed
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 11, 2026

CodeAnt AI is running the review.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:M This PR changes 30-99 lines, ignoring generated files and removed size:M This PR changes 30-99 lines, ignoring generated files labels May 11, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 11, 2026

Sequence Diagram

This PR adds a GitHub Actions workflow that runs Claude Code when authorized users mention Claude in pull request comments or reviews, and posts automated responses back to the same thread.

sequenceDiagram
    participant Developer
    participant GitHub
    participant Workflow
    participant ClaudeAction
    participant ClaudeService

    Developer->>GitHub: Add PR comment or review mentioning Claude
    GitHub->>Workflow: Trigger Claude Code workflow on comment or review event
    Workflow->>Workflow: Verify event is PR related and author is member or collaborator

    alt Conditions met
        Workflow->>ClaudeAction: Run claude code action with repo and secret token
        ClaudeAction->>ClaudeService: Send code context and request assistance
        ClaudeService-->>ClaudeAction: Return suggested reply or code review
        ClaudeAction-->>GitHub: Post Claude response in PR thread
    else Conditions not met
        Workflow->>GitHub: Skip Claude automation
    end
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 11, 2026

CodeAnt AI finished running the review.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 11, 2026

CodeAnt AI is running the review.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:M This PR changes 30-99 lines, ignoring generated files and removed size:M This PR changes 30-99 lines, ignoring generated files labels May 11, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 11, 2026

Sequence Diagram

This PR adds a GitHub Actions workflow that listens for claude mentions in pull request comments and reviews from authorized collaborators, then runs the Claude Code action to post automated replies on the PR thread.

sequenceDiagram
    participant RepoMember
    participant GitHub
    participant ClaudeWorkflow
    participant ClaudeCode

    RepoMember->>GitHub: Comment on PR with claude mention
    GitHub->>ClaudeWorkflow: Trigger comment or review workflow
    ClaudeWorkflow->>ClaudeWorkflow: Check PR context and author permissions
    ClaudeWorkflow->>ClaudeCode: Run Claude Code action
    ClaudeCode-->>GitHub: Post AI reply to PR discussion
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 11, 2026

CodeAnt AI finished running the review.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants