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

Merged
BL
12d ago
+75-0

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 blurbery/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.