Skip to content

Claude Review (from upstream branch) - #239

Closed
CassNot wants to merge 15 commits into
mainfrom
claude-review
Closed

Claude Review (from upstream branch)#239
CassNot wants to merge 15 commits into
mainfrom
claude-review

Conversation

@CassNot

@CassNot CassNot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR introduces a new GitHub Actions workflow that enables Claude to provide automated code reviews on pull requests, with security controls to restrict access to organization members.
Features

  • On-demand code reviews: Members can request Claude reviews by commenting @claude on PRs, issues, or review comments
  • Manual trigger option: Alternatively, trigger reviews manually via GitHub Actions > Claude Code > Run workflow
  • Organization member verification: Workflow automatically verifies that the requesting user is an organization member before running
  • Comments-only access: Claude has read-only access to code and can post review comments but cannot make direct modifications
  • CI-aware reviews: Claude can read CI results to provide context-aware feedback

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / Cleanup
  • Performance improvement
  • CI / Build / Tooling
  • Breaking change (requires migration notes)

Proposed changes

How to Use
Automatic trigger: simply comment @claude anywhere on a PR, and the workflow will automatically trigger.

Manual trigger:

  • Go to Actions → Claude Code
  • Click Run workflow
  • Claude will review the current PR

Permissions

  • contents: read — Read-only access to code and tests
  • pull-requests: write — Can post comments and reviews
  • id-token: write — Authentication with Anthropic API
  • actions: read — Access to CI results

Security

  • Membership check ensures only organization members can trigger reviews
  • No write access to code (comments only)
  • Supports ANTHROPIC_API_KEY secret for API authentication

@CassNot CassNot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Test review

Comment thread .github/workflows/claude.yml

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2282e1e1de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +76 to +78
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Constrain the token Claude actually uses

When this job is triggered, this invocation does not pass a github_token, so anthropics/claude-code-action@v1 mints and uses its own Claude GitHub App token via OIDC. The action's default app-token request includes contents: write, so the job-level contents: read permission above does not enforce the advertised comments-only behavior and Claude can still push commits/branches when responding to an org member's @claude request. If this workflow is meant to be review-only, pass a token constrained to read contents and comment/review permissions or otherwise disable the action's write-capable token path.

Useful? React with 👍 / 👎.

Comment thread .github/workflows/claude.yml Outdated
name: Claude Code

on:
workflow_dispatch:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add a real prompt for manual dispatches

For workflow_dispatch, the Claude action treats the run as automation mode and skips unless a prompt input is provided; this workflow defines no dispatch inputs and passes only the API key. As a result, using Actions → Run workflow will pass the membership check and then do no review, which contradicts the documented manual trigger path. Add inputs such as a PR number plus a prompt, or remove the manual trigger.

Useful? React with 👍 / 👎.

contents: read # Read-only access to code
pull-requests: write # Can post comments/reviews on PRs
id-token: write # Required for authentication
actions: read # Required for Claude to read CI results on PRs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Forward Actions access to Claude's app token

Granting actions: read to the job token is not enough for Claude to inspect CI results here, because the action uses its own app token and only requests extra scopes when with.additional_permissions includes them. In prompts like @claude why did CI fail?, Claude will not get the GitHub Actions MCP tools despite this permission line. Add additional_permissions: | actions: read to the action inputs.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ad6c6256c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +80 to +82
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Permit org members without repo write access

In the org-member-but-not-repo-writer case, this job passes the membership check but anthropics/claude-code-action@v1 still performs its own write-permission gate for issue/PR contexts before it runs. I checked the action's action.yml/run.ts: allowed_non_write_users only works when a github_token input is supplied, and the current invocation supplies neither, so many organization members will see the workflow fail with “Actor does not have write permissions” instead of getting the advertised org-member-triggered review.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

⚠️ Coverage Report

Overall Coverage: 79.07%

Coverage Status

  • Target: 80% (warning threshold)
  • Current: 79.07%
  • Status: ⚠️ Below target

Coverage reports are informational and do not block PRs.
Generated using pytest-cov

@CassNot CassNot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Test 2

Comment thread .github/workflows/claude.yml

@CassNot CassNot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

test 3 with no app

pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@claude review

@CassNot

CassNot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@claude please review this PR

@CassNot CassNot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Test 5 with debug


jobs:
claude:
runs-on: ubuntu-latest

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@claude review

@LF-Vigneux

Copy link
Copy Markdown
Contributor

@claude Review

runs-on: ubuntu-latest
permissions:
contents: read # Read-only access to code
pull-requests: write # Can post comments/reviews on PRs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@claude review

@CassNot CassNot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Test with permissions

on:
issue_comment:
types: [created]
pull_request_review_comment:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@claude review

@CassNot CassNot closed this Jun 10, 2026
@CassNot
CassNot deleted the claude-review branch June 10, 2026 19:01
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.

2 participants