Skip to content

ci: add Claude code review for pull requests [skip release] - #121

Merged
blurbery merged 5 commits into
mainfrom
ci/claude-code-review
Oct 10, 2026
Merged

blurbery merged 5 commits into
mainfrom
ci/claude-code-review

Conversation

@blurbery

@blurbery blurbery commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Problem and reproduction

I want Claude reviewing my own PRs alongside cubic without it eating into paid API credits.

Implementation and impact

  • Adds .github/workflows/claude-code-review.yml. Each PR gets one review from a single Claude Sonnet pass (claude-sonnet-5-5) through anthropics/claude-code-action. It posts inline comments on real problems and one short summary comment, and reads AGENTS.md and CONTRIBUTING.md for the project rules.
  • I started with Anthropic's multi-agent code-review plugin, but it runs several agents, including two on Opus, on every PR. At around 100 PRs a month that would cost far more than it's worth, so this uses one Sonnet pass instead.
  • Runs when a PR is opened, updated, reopened or marked ready for review, but a check step skips it once the summary comment (marked <!-- claude-review -->) exists, so each PR gets one review, including PRs that start Markdown-only and gain code later. Skips drafts, bot PRs, fork PRs (GitHub withholds secrets from them) and Markdown-only changes. Cubic still covers fork PRs.
  • Uses a CLAUDE_CODE_OAUTH_TOKEN secret so reviews run on my Claude subscription's included usage, falling back to ANTHROPIC_API_KEY only when no token is set. With neither, the job just skips.
  • Posts with the workflow's own GITHUB_TOKEN (read-only code access, write access to PR comments only), so it doesn't depend on the Claude GitHub App. Capped at a 15-minute timeout and 25 turns, and the action is pinned to the v1.0.248 commit.
  • Nothing else changes.

Validation

  • actionlint passes.
  • The first run reached the Claude API and failed with "Credit balance is too low", because the API key had no credit. That's why it now uses the subscription token.
  • With the token added, the review ran on this PR in 4 turns (about 15 seconds) and posted its summary comment.
  • Re-running the job afterwards skipped the review step because the marked summary already existed.
  • The same workflow ran the same way on ci: add a Claude review for pull requests cinesets#51.

Performance

Not applicable.

Testing status

  • Tested? Yes
  • Environment: GitHub Actions on this PR
  • Revision: This PR's head commit
  • Checks and results: Review ran with the subscription token and posted its summary; a re-run skipped as intended.
  • Limitations: No PR with real code problems has been reviewed yet, so I haven't seen how good its inline comments are.

Design impact and approval

  • Design impact: No design changes
  • Approval from blurbery: Not applicable, no design changes.

Documentation impact

No documentation changes. No existing docs mention review bots.

AI disclosure

I implemented these changes and used Claude Opus as a tool.

Runs Anthropic's code-review plugin through claude-code-action once per
pull request and posts inline findings. Skips drafts and fork PRs, which
don't receive repository secrets.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 1 file

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread .github/workflows/claude-code-review.yml Outdated
One Sonnet call per PR instead of the multi-agent code-review plugin, to keep costs down. Uses the workflow's GITHUB_TOKEN to post comments, skips Markdown-only and bot PRs, and does nothing when no API key is set.
@blurbery blurbery closed this Oct 10, 2026
@blurbery blurbery reopened this Oct 10, 2026
@blurbery blurbery closed this Oct 10, 2026
@blurbery blurbery reopened this Oct 10, 2026
Prefers CLAUDE_CODE_OAUTH_TOKEN so reviews use the subscription's included usage, falling back to ANTHROPIC_API_KEY only when no token is set. Drops the temporary full output.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread .github/workflows/claude-code-review.yml
@blurbery blurbery closed this Oct 10, 2026
@blurbery blurbery reopened this Oct 10, 2026
@github-actions

Copy link
Copy Markdown

No blocking problems found in the workflow. Permissions are minimal, the action is pinned to a commit, fork and bot PRs are skipped, and the tool allowlist is tight. One thing to note: the full review hasn't completed yet, so it still needs a run once the token secret is added.

Also runs on pushes, but skips once the marked summary comment exists, so each PR still gets one review. Queued runs wait instead of cancelling a review part way through.
@github-actions

Copy link
Copy Markdown

No problems found. The workflow's guards, token permissions and pinned action look sound.

@blurbery
blurbery merged commit 946e591 into main Oct 10, 2026
3 checks passed
@blurbery
blurbery deleted the ci/claude-code-review branch October 10, 2026 06:34
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.

1 participant