Skip to content

Conversation

@MarjovanLier
Copy link
Owner

@MarjovanLier MarjovanLier commented Aug 22, 2025

User description

🤖 Installing Claude Code GitHub App

This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.

What is Claude Code?

Claude Code is an AI coding agent that can help with:

  • Bug fixes and improvements
  • Documentation updates
  • Implementing new features
  • Code reviews and suggestions
  • Writing tests
  • And more!

How it works

Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.

Important Notes

  • This workflow won't take effect until this PR is merged
  • @claude mentions won't work until after the merge is complete
  • The workflow runs automatically whenever Claude is mentioned in PR or issue comments
  • Claude gets access to the entire PR or issue context including files, diffs, and previous comments

Security

  • Our Anthropic API key is securely stored as a GitHub Actions secret
  • Only users with write access to the repository can trigger the workflow
  • All Claude runs are stored in the GitHub Actions run history
  • Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
  • We can add more allowed tools by adding them to the workflow file like:
allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)

There's more information in the Claude Code action repo.

After merging this PR, let's try mentioning @claude in a comment on any PR to get started!


PR Type

Enhancement


Description

  • Add automated Claude Code Review workflow for PRs

  • Update existing Claude workflow with OAuth token authentication

  • Remove repository-specific restrictions for broader access

  • Add comprehensive configuration options and documentation


Diagram Walkthrough

flowchart LR
  PR["Pull Request"] --> Review["Claude Code Review"]
  Comment["@claude mention"] --> Assistant["Claude Assistant"]
  Review --> Feedback["Automated Feedback"]
  Assistant --> Response["Interactive Response"]
Loading

File Walkthrough

Relevant files
Enhancement
claude-code-review.yml
Add automated Claude PR review workflow                                   

.github/workflows/claude-code-review.yml

  • Create new automated PR review workflow
  • Configure comprehensive review criteria and options
  • Add flexible filtering and customization settings
  • Include detailed documentation and examples
+78/-0   
claude.yml
Update Claude workflow authentication and permissions       

.github/workflows/claude.yml

  • Update authentication from API key to OAuth token
  • Remove repository and user-specific restrictions
  • Add actions read permissions for CI integration
  • Include extensive configuration options and examples
+35/-10 

@gemini-code-assist
Copy link

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@coderabbitai
Copy link

coderabbitai bot commented Aug 22, 2025

📝 Walkthrough

Walkthrough

Introduces a new GitHub Actions workflow for automated Claude-based code reviews on pull requests and updates an existing Claude workflow to adjust triggers, permissions, and token configuration, adding optional commented settings.

Changes

Cohort / File(s) Summary of edits
New Claude code review workflow
\.github/workflows/claude-code-review.yml
Adds a workflow triggered on pull_request (opened, synchronize). Sets permissions (contents/pull-requests/issues: read; id-token: write). Checks out repo and runs anthropics/claude-code-action@beta with secrets.CLAUDE_CODE_OAUTH_TOKEN and a default review prompt. Includes commented options (model, sticky comments, per-file/author prompts, allowed tooling, skip conditions).
Claude workflow trigger/permission updates
\.github/workflows/claude.yml
Simplifies gating to event- and content-based checks for “@claude” across issue_comment, pull_request_review_comment, pull_request_review, and issues. Lowers permissions to read and adds actions: read; retains id-token: write. Switches to claude_code_oauth_token from secrets. Adds commented optional configuration blocks (model, trigger_phrase, assignee_trigger, allowed_tools, custom_instructions, claude_env).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub (PR)
  participant GA as GitHub Actions
  participant Job as claude-code-review.yml
  participant Act as anthropics/claude-code-action
  participant CL as Claude Service

  Dev->>GH: Open/Synchronize PR
  GH-->>GA: Trigger workflow (pull_request)
  GA->>Job: Run job (ubuntu-latest)
  Job->>Act: Invoke action with OAuth token + prompt
  Act->>CL: Submit review request (diff/context)
  CL-->>Act: Analysis & review results
  Act-->>GH: Post review/comments on PR
Loading
sequenceDiagram
  autonumber
  actor User as User
  participant GH as GitHub (Issues/PR Reviews/Comments)
  participant GA as GitHub Actions
  participant Flow as claude.yml
  participant Act as anthropics/claude-code-action
  participant CL as Claude Service

  User->>GH: Post content containing "@claude"
  GH-->>GA: Trigger on eligible events
  GA->>Flow: Evaluate if-condition on event + content
  alt Condition passes
    Flow->>Act: Run action with OAuth token (+optional configs)
    Act->>CL: Send prompt/context
    CL-->>Act: Response
    Act-->>GH: Post reply/comment
  else Condition fails
    GA-->>User: No action
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Add Claude Code GitHub Workflow #46 — Also modifies .github/workflows/claude.yml triggers/permissions/tokens for Claude, indicating closely related workflow configuration changes.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-claude-github-actions-1755862980984

🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@MarjovanLier MarjovanLier enabled auto-merge (squash) August 22, 2025 11:43
@MarjovanLier MarjovanLier requested a review from Copilot August 22, 2025 11:43
@qodo-code-review
Copy link
Contributor

Changelog updates: 🔄

2025-08-22 *

Added

  • GitHub Actions workflow for automated AI code reviews and PR feedback

Changed

  • Updated AI assistant workflow to use OAuth authentication and adjusted permissions

to commit the new content to the CHANGELOG.md file, please type:
'/update_changelog --pr_update_changelog.push_changelog_changes=true'

@codecov
Copy link

codecov bot commented Aug 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (324c55c) to head (bfeceaa).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #48   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity        33        33           
===========================================
  Files              1         1           
  Lines             81        81           
===========================================
  Hits              81        81           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Aug 22, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Reassess permissions and triggers

The workflows significantly broaden triggers and reduce permissions (write ->
read) while removing repo/user scoping, which may block expected behavior (e.g.,
commenting on PRs) and increase unintended runs across all issues/PRs mentioning
@claude. Verify that the action actually requires write permissions to post
reviews/comments and consider reinstating minimal necessary write scopes and
tighter trigger conditions (repo/user filters or path filters) to avoid noisy or
unauthorized executions.

Examples:

.github/workflows/claude.yml [15-26]
    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: read
      pull-requests: read
      issues: read

 ... (clipped 2 lines)
.github/workflows/claude-code-review.yml [22-26]
    permissions:
      contents: read
      pull-requests: read
      issues: read
      id-token: write

Solution Walkthrough:

Before:

# .github/workflows/claude.yml
jobs:
  claude:
    if: |
      # Runs for any user in the repo who mentions @claude
      (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
      ...
    permissions:
      # Read-only permissions may prevent the action from posting comments
      pull-requests: read
      issues: read
      ...

After:

# .github/workflows/claude.yml
jobs:
  claude:
    if: |
      # Optional: Restrict triggers to specific users or conditions
      github.actor == 'some-user' && (
        (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
        (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
        ...
      )
    permissions:
      # Write permissions are likely needed to post comments/reviews
      pull-requests: write
      issues: write
      ...
Suggestion importance[1-10]: 9

__

Why: This suggestion correctly identifies a critical flaw where changing permissions from write to read will likely break the action's ability to post comments, defeating the PR's purpose.

High
Security
Pin action to commit SHA

Pin the action to a specific commit SHA to prevent supply-chain risks and
unexpected behavior from tag moves. Reference the official commit for the
intended beta version.

.github/workflows/claude-code-review.yml [36]

-uses: anthropics/claude-code-action@beta
+uses: anthropics/claude-code-action@<commit-sha>
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: This is a valid security best practice to pin actions to a commit SHA, preventing supply-chain attacks from a compromised tag, which is particularly relevant for a beta version.

Medium
  • Update

@qodo-code-review
Copy link
Contributor

Manual-approval option for PR-Agent is disabled. You can enable it via a configuration file

This comment was marked as outdated.

@qodo-code-review
Copy link
Contributor

Changelog updates: 🔄

2025-08-22 *

Added

  • GitHub Actions workflow for automated AI-powered code reviews.

Changed

  • Updated AI assistant workflow to use OAuth authentication and broaden access permissions.

to commit the new content to the CHANGELOG.md file, please type:
'/update_changelog --pr_update_changelog.push_changelog_changes=true'

@qodo-code-review
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🔒 Security concerns

Workflow secret exposure:
Ensure that the action does not echo or log the value of claude_code_oauth_token. Also review that running on comments/issues cannot be abused by untrusted users to trigger costly runs; consider adding conditions to restrict to repository members or trusted actors.

⚡ Recommended focus areas for review

Permission Changes

Reducing permissions from write to read for pull-requests/issues may break any existing behavior where the action needs to comment, label, or modify PRs/issues. Confirm that the action does not require write permissions, or explicitly grant minimal required writes.

permissions:
  contents: read
  pull-requests: read
  issues: read
  id-token: write
  actions: read # Required for Claude to read CI results on PRs
steps:
Token Requirement

The workflow relies on claude_code_oauth_token but provides no fallback or validation. Ensure the secret exists in all environments (including forks) or guard with conditional to avoid failing runs on external PRs.

claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
Trigger Scope

Expanded triggers will run on any repo events containing '@claude'. Verify intended scope to avoid noise or unintended execution (e.g., automated comments or issue titles). Consider additional filters or rate limiting.

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

@qodo-code-review
Copy link
Contributor

Manual-approval option for PR-Agent is disabled. You can enable it via a configuration file

@MarjovanLier MarjovanLier requested a review from Copilot August 22, 2025 11:52
@MarjovanLier MarjovanLier disabled auto-merge August 22, 2025 11:52
@MarjovanLier MarjovanLier merged commit a1c6432 into main Aug 22, 2025
12 checks passed
@MarjovanLier MarjovanLier deleted the add-claude-github-actions-1755862980984 branch August 22, 2025 11:52
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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/claude.yml (1)

33-36: Pin to a fixed commit SHA for Claude Code Action

No stable semver release exists beyond the beta tag (which currently resolves to main). To mitigate supply-chain risk, pin the action to an immutable commit SHA:

• File: .github/workflows/claude.yml (around lines 33–36)

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

• Fetch the latest commit SHA on main with:

gh api repos/anthropics/claude-code-action/git/ref/heads/main --jq '.object.sha'

Replace <COMMIT_SHA> with the returned value and commit the update.

Keep an eye on the repository for an official tagged release (e.g. v1.0.0) and upgrade once it’s available.

🧹 Nitpick comments (9)
.github/workflows/claude-code-review.yml (4)

28-33: Add concurrency to auto-cancel stale reviews on new pushes.

Prevents duplicate feedback and saves API budget.

 jobs:
   claude-review:
+    concurrency:
+      group: claude-review-${{ github.event.pull_request.number }}
+      cancel-in-progress: true

43-53: Tighten the direct_prompt to align with your PHP standards and expectations.

Make Claude consistently enforce your house style (PER CS 2.0/PSR-12), immutability where sensible, and test expectations.

           direct_prompt: |
-            Please review this pull request and provide feedback on:
-            - Code quality and best practices
-            - Potential bugs or issues
-            - Performance considerations
-            - Security concerns
-            - Test coverage
-            
-            Be constructive and helpful in your feedback.
+            Review this PR with focus on:
+            - PHP style: PER Coding Style 2.0 (PSR-12/PSR-1), naming, formatting.
+            - Design: SOLID, FOOP, immutability/pure functions where practical.
+            - Correctness: edge cases, null/empty handling, off-by-one, timezones.
+            - Security: injection, XSS, CSRF, path traversal, secrets/PII handling.
+            - Performance: N+1, hot paths, allocations; suggest simple wins.
+            - Tests: coverage of branches and failure paths; request missing cases.
+            Keep feedback concise, actionable, and code-first (include diffs where useful).

I can tailor this per directory/file type if you share your project conventions.


71-73: If enabling Bash tools, sandbox aggressively.

Allowing Bash(...) grants arbitrary command exec. Keep it disabled by default; if enabling, restrict to read-only commands, set a safe working directory, and ensure no repo secrets are injected.

-          # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
+          # allowed_tools: |
+          #   Bash(npm ci --ignore-scripts --no-audit --no-fund)
+          #   Bash(npm run -s lint)
+          #   Bash(npm run -s test -- --reporter=min --maxWorkers=2)

20-20: Clean trailing spaces and extra blank line to satisfy YAML linting.

Minor hygiene; it keeps CI quiet.

No functional change—just remove trailing spaces and the final blank line.

Also applies to: 27-27, 51-51, 56-56, 64-64, 67-67, 70-70, 73-73, 79-79

.github/workflows/claude.yml (5)

15-19: Good, targeted gating on mention content.

The if: guards are clear and avoid unnecessary runs. Consider adding a simple anti-abuse check if mention spam becomes an issue (see comment below).


28-32: Consider concurrency to cancel prior runs on rapid comment edits.

Prevents duplicative replies when users edit comments quickly.

 jobs:
   claude:
+    concurrency:
+      group: claude-${{ github.event_name }}-${{ github.event.repository?.name || 'repo' }}-${{ github.run_id }}
+      cancel-in-progress: true

If you prefer per-thread grouping, derive the group from github.event.issue.number or github.event.pull_request.number depending on event type.


39-42: Optional knobs look good; consider enabling a safer trigger phrase and assignee gating.

To prevent random mentions from triggering runs, you can require /claude or an assignee match.

-          # trigger_phrase: "/claude"
+          # trigger_phrase: "/claude"
+
-          # assignee_trigger: "claude-bot"
+          # assignee_trigger: "claude-bot" # only respond when assigned

Also applies to: 43-45, 46-48, 49-51, 52-54, 55-60


42-42: Remove trailing spaces and the final extra blank line.

Keeps YAMLlint green; no behavioral change.

Also applies to: 45-45, 48-48, 51-51, 54-54, 60-60, 64-64


21-27: Validate whether id-token: write is needed here.

Keep it if the action mints a GitHub App token using OIDC (it likely does, given additional_permissions). Otherwise, drop it for least privilege.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f7e2331 and addfefc.

📒 Files selected for processing (2)
  • .github/workflows/claude-code-review.yml (1 hunks)
  • .github/workflows/claude.yml (2 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] 51-51: trailing spaces

(trailing-spaces)


[error] 56-56: 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)


[error] 73-73: trailing spaces

(trailing-spaces)


[warning] 78-78: too many blank lines (1 > 0)

(empty-lines)

.github/workflows/claude.yml

[error] 42-42: trailing spaces

(trailing-spaces)


[error] 45-45: trailing spaces

(trailing-spaces)


[error] 48-48: trailing spaces

(trailing-spaces)


[error] 51-51: trailing spaces

(trailing-spaces)


[error] 54-54: trailing spaces

(trailing-spaces)


[error] 60-60: trailing spaces

(trailing-spaces)


[warning] 64-64: too many blank lines (1 > 0)

(empty-lines)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: guardrails/scan
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (8.4)
  • GitHub Check: build (8.3)
🔇 Additional comments (4)
.github/workflows/claude-code-review.yml (2)

36-41: ✅ Action owner verified
The GitHub Action uses the correct repository owner (anthropics/claude-code-action), so no changes are needed to avoid 404s. You can leave the commented model example in place for future reference.


34-37: Pin Claude Code Action to Latest Stable Release

To mitigate supply-chain risk, replace the mutable @beta ref with the latest semver tag (v0.0.62, released 2025-08-21):

• File: .github/workflows/claude-code-review.yml (lines 34–37)

-        uses: anthropics/claude-code-action@beta
+        uses: anthropics/claude-code-action@v0.0.62

This change locks the action to a fixed, audited version and avoids unexpected updates.

.github/workflows/claude.yml (2)

33-37: Owner spelling verified – no changes needed

The GitHub repository anthropics/claude-code-action exists and is spelled correctly, so the workflow step should continue using the anthropics owner as-is.

– File: .github/workflows/claude.yml (lines 33–37)
– Workflow step: uses: anthropics/claude-code-action@beta


21-27: With read-only PR/Issues perms, Claude won’t be able to reply. Add scoped write via additional_permissions.

You lowered job-level perms to read (good for least privilege), but the action must still obtain a token with issues: write and/or pull-requests: write to post comments/reviews.

Minimal change:

       id-token: write
       actions: read # Required for Claude to read CI results on PRs
@@
       - name: Run Claude Code
         id: claude
         uses: anthropics/claude-code-action@beta
         with:
           claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
 
           # This is an optional setting that allows Claude to read CI results on PRs
           additional_permissions: |
-            actions: read
+            actions: read
+            issues: write
+            pull-requests: write

If you also want branch/commit writes, add contents: write here (and document it in the repo).

Likely an incorrect or invalid review comment.

# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

runs-on: ubuntu-latest
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Guard secrets on forked PRs to avoid failed runs.

pull_request workflows don’t expose repo secrets to forks. Add a job-level condition to only run reviews when the source repo is the same as the base. Otherwise, skip gracefully.

 jobs:
   claude-review:
+    if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}

Optional: If you need reviews on forks, switch to pull_request_target and take strict precautions (checkout base ref, never execute fork code, and keep allowed tools disabled).


🏁 Script executed:

#!/bin/bash
set -e

workflow=".github/workflows/claude-code-review.yml"
if [ ! -f "$workflow" ]; then
  echo "Error: $workflow not found"
  exit 1
fi

# Print the first 200 lines of the workflow for inspection
sed -n '1,200p' "$workflow"

Length of output: 3208


Guard secrets on forked pull requests

To prevent failures when CLAUDE_CODE_OAUTH_TOKEN isn’t exposed on forked PRs, add a job‐level guard so the review only runs for PRs originating in the same repo.

• File: .github/workflows/claude-code-review.yml
Location: under jobs.claude-review: (before runs-on:)

 jobs:
   claude-review:
+    if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
     runs-on: ubuntu-latest

Optional: If you need to run reviews on forked PRs, consider switching to pull_request_target, but strictly checkout the base ref and never execute untrusted code.

📝 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
runs-on: ubuntu-latest
jobs:
claude-review:
# only run this job on PRs from the same repository so that secrets are available
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
# …rest of the job steps…
🤖 Prompt for AI Agents
In .github/workflows/claude-code-review.yml around line 21 (jobs.claude-review
section) the job unguardedly runs on PRs which can hide CLAUDE_CODE_OAUTH_TOKEN
for forked PRs; add a job-level guard (an if condition) so the job only runs for
PRs originating from the same repository, e.g. add a condition like if:
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository before the
runs-on line to skip forked-PR runs, or alternatively switch to
pull_request_target but ensure you strictly checkout the base ref and never
execute untrusted code.

Comment on lines +22 to +27
permissions:
contents: read
pull-requests: read
issues: read
id-token: write

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Action cannot post PR reviews with read-only PR permissions. Elevate via additional_permissions (preferred) or job perms.

As written, pull-requests: read prevents the action from creating PR comments/reviews. If you intend Claude to leave review feedback, grant the minimal write it needs.

Apply one of the following:

Option A — keep job token minimal and let the action mint a short-lived App token with scoped writes (recommended):

       id-token: write
     
     steps:
@@
       - name: Run Claude Code Review
         id: claude-review
         uses: anthropics/claude-code-action@beta
         with:
           claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
+          additional_permissions: |
+            pull-requests: write
+            actions: read

Option B — job-level permission (works but grants broader scope for the job):

     permissions:
       contents: read
-      pull-requests: read
+      pull-requests: write
       issues: read
       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: read
id-token: write
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 27-27: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/claude-code-review.yml around lines 22 to 27, the workflow
currently sets pull-requests: read which prevents the action from posting PR
reviews; fix by granting the minimal write scope either by adding an
additional_permissions entry for the specific action (additional_permissions:
pull-requests: write) so the action can mint a short-lived token with scoped
write access, or by changing the job-level permissions to pull-requests: write
if you prefer broader job permission; apply one of these two options and keep
other permissions minimal.

Comment on lines +74 to +78
# Optional: Skip review for certain conditions
# if: |
# !contains(github.event.pull_request.title, '[skip-review]') &&
# !contains(github.event.pull_request.title, '[WIP]')

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

The commented skip example shows if: inside with: (invalid). Move it to the step.

if: is a step/job key, not an input. Keeping an incorrect example can mislead future edits.

-      - name: Run Claude Code Review
-        id: claude-review
-        uses: anthropics/claude-code-action@beta
-        with:
-          # ...
-          # Optional: Skip review for certain conditions
-          # if: |
-          #   !contains(github.event.pull_request.title, '[skip-review]') &&
-          #   !contains(github.event.pull_request.title, '[WIP]')
+      - name: Run Claude Code Review
+        if: |
+          !contains(github.event.pull_request.title, '[skip-review]') &&
+          !contains(github.event.pull_request.title, '[WIP]')
+        id: claude-review
+        uses: anthropics/claude-code-action@beta
+        with:
+          # ...
📝 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
# Optional: Skip review for certain conditions
# if: |
# !contains(github.event.pull_request.title, '[skip-review]') &&
# !contains(github.event.pull_request.title, '[WIP]')
- name: Run Claude Code Review
if: |
!contains(github.event.pull_request.title, '[skip-review]') &&
!contains(github.event.pull_request.title, '[WIP]')
id: claude-review
uses: anthropics/claude-code-action@beta
with:
# ...
🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 78-78: too many blank lines (1 > 0)

(empty-lines)

🤖 Prompt for AI Agents
In .github/workflows/claude-code-review.yml around lines 74–78, the commented
example places an `if:` conditional under `with:` (which is invalid because
`if:` is a step/job key, not an input); update the comment so it instructs
moving the `if:` out of `with:` to the step (or job) level and show the correct
usage in prose (e.g., describe adding `if:` on the step line before
`uses:`/`run:`), removing or replacing the misleading commented block.

Copy link

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

This PR adds Claude Code integration to the repository by introducing an automated PR review workflow and updating the existing Claude workflow with OAuth authentication. The changes enable AI-powered code reviews and interactive assistance through @claude mentions.

  • Add a new automated Claude Code Review workflow that runs on all pull requests
  • Update existing Claude workflow to use OAuth token authentication instead of API key
  • Remove repository-specific restrictions to allow broader access to the Claude functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/claude-code-review.yml New automated PR review workflow with comprehensive configuration options
.github/workflows/claude.yml Updated authentication method and removed access restrictions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

pull-requests: write
issues: write
pull-requests: read
issues: read
Copy link

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

The permissions have been changed from 'write' to 'read' for pull-requests and issues, but Claude Code typically needs write permissions to post comments and provide feedback. This may prevent Claude from functioning properly.

Suggested change
issues: read
pull-requests: write
issues: write

Copilot uses AI. Check for mistakes.
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
Copy link

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

The Claude Code Review workflow only has 'read' permissions for pull-requests, but it likely needs 'write' permissions to post review comments and feedback on the PR.

Suggested change
pull-requests: read
pull-requests: write

Copilot uses AI. Check for mistakes.
# model: "claude-opus-4-1-20250805"

# Direct prompt for automated review (no @claude mention needed)
direct_prompt: |
Copy link

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

The word 'direct_prompt' appears to be a parameter name, but based on typical GitHub Actions conventions and the anthropics/claude-code-action documentation, this should likely be 'prompt' instead of 'direct_prompt'.

Suggested change
direct_prompt: |
prompt: |

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants