Skip to content

Pull requests get no automated review while claude-review.yml is off: fire a Claude code-review routine instead #1292

Closed

Description

@tobyhede

Background

This repository has an automated code review that runs on GitHub Actions: .github/workflows/claude-review.yml. It runs Claude inside the CI job through claude-code-action. It is switched off unless the repository variable CLAUDE_REVIEW_ENABLED is true, because a turn limit, a cancelled run or an API error used to leave pull requests with a failed check.

A Claude Code routine is a saved Claude session that runs in the cloud and can be started over HTTP by posting to its trigger (a trig_… id). A routine can review a pull request without running inside the CI job.

Problem

With claude-review.yml switched off, nothing reviews pull requests automatically. A person has to remember to ask for a review on each one.

Proposal

Add a Code review workflow that fires the code-review routine when a pull request is ready:

  1. Run on opened, reopened and ready_for_review. Do not run on every push (synchronize), so a pull request gets one review per event. To get a fresh review, mark it draft and then ready again.
  2. Skip drafts, pull requests opened by bots (Dependabot, release-plz) and pull requests from forks, because forks are not given the repository's secrets.
  3. Send one curl POST to the routine's /fire endpoint with the pull request's URL and number. Pass the bearer token on standard input, never on the command line. Check the trigger id against ^trig_[A-Za-z0-9]+$ before putting it in the URL. Do not retry, because a request that timed out may already have started a session.
  4. Keep it advisory: a failed request shows as a failed step in the run, not as a red check on the pull request (continue-on-error).
  5. Allow one run per pull request at a time (a concurrency group keyed on the pull request number), so a burst of reopen or draft/ready events starts at most two reviews.
  6. Configure it with a repository secret CLAUDE_ROUTINE_TOKEN (the routine's bearer token) and a repository variable CLAUDE_ROUTINE_TRIGGER_ID (its trig_… id).

Relationship to other work


Generated by Claude Code

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

Metadata

Metadata

Assignees

Labels

SDKenhancementNew feature or requestgithub-actionsPull request modifies GitHub Actions

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions