Skip to content

ci: add @claude on-demand alongside the automatic review - #10

Merged
jacobyoby merged 3 commits into
mainfrom
ci/claude-on-demand
Sep 11, 2026
Merged

jacobyoby merged 3 commits into
mainfrom
ci/claude-on-demand

Conversation

@jacobyoby

@jacobyoby jacobyoby commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Adds claude.yml: Claude in tag mode. It runs only when someone with write access writes @claude in an issue, pull request comment or review — a question gets answered in the thread; an instruction gets a branch pushed. It does not run on pushes.

Why on demand

The automatic review in claude-code-review.yml runs on every push to every PR. That's the right default for the front-door page, but it's also the only thing in either repo that costs real money. @claude costs nothing until someone asks for it. This PR adds the on-demand path beside the automatic one rather than replacing it — dropping the automatic review later is deleting one file.

How it stays cheap and safe

  • The job is gated on the mention itself (contains(…, '@claude')), so ordinary comments never start a runner.
  • No prompt input, deliberately. A prompt is what turns the action into an every-event automation.
  • Non-write users can't trigger it — the action's default; allowed_non_write_users is not set and must not be on a public repo.
  • Skips green while CLAUDE_CODE_OAUTH_TOKEN isn't visible, same gate as the review workflow.
  • timeout-minutes: 30; concurrency keyed per issue/PR.

Authentication follows #11

The first real run of the review action on this PR failed after 435 ms with is_error: true and total_cost_usd: 0 — the API-key path needs a prepaid credit balance, which #8 surfaced as "Your credit balance is too low". #11 moved the review workflow to claude_code_oauth_token / CLAUDE_CODE_OAUTH_TOKEN (from claude setup-token, billed to the subscription). This workflow reads the same secret with the same skip-when-unset gate, so the two cannot drift apart on how they authenticate. main is merged into this branch so the review check re-runs on the OAuth path.

A correction to my earlier change

This includes id-token: write. I removed it from the review workflow earlier as unused, and #9 restored it — correctly. The action exchanges the workflow's OIDC token to post as the Claude GitHub App rather than github-actions[bot], so tag mode needs it too. The permissions here follow the action's documented tag-mode template: contents: write (it pushes branches when asked to make a change), pull-requests: write, issues: write, id-token: write.

Pins

actions/checkout v7.0.1 and anthropics/claude-code-action v1 by commit SHA. The action's v1 is an annotated tag, so the pin is the commit it dereferences to, not the tag object.

Verification

YAML parses; the job has an if gate and a timeout; both uses: are SHA-pinned with the version in a trailing comment; the file is byte-identical to the copy proposed for beanstalk in jacobrakaiFoundation/beanstalk#125.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VzsJf6bUyYZdq3kxJ8DGix


Generated by Claude Code

claude.yml runs Claude in tag mode: only when someone with write access
writes `@claude` in an issue, pull request comment or review. The job is
gated on the mention itself, so ordinary comments never start a runner, and
there is no `prompt` input — a prompt is what would turn this into an
every-event automation. It sits beside claude-code-review.yml rather than
replacing it; dropping the automatic review later is deleting one file.

`id-token: write` is included. I removed it from the review workflow earlier
as unused and #9 restored it — correctly: the action exchanges the workflow's
OIDC token to post as the Claude GitHub App, so tag mode needs it as well.

Skips green while ANTHROPIC_API_KEY is not visible to this repository.
Actions pinned to commit SHAs; the claude-code-action pin is the commit its
annotated v1 tag dereferences to, not the tag object.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VzsJf6bUyYZdq3kxJ8DGix
@claude

claude Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

Follow #11: the review action now reads CLAUDE_CODE_OAUTH_TOKEN because the
API-key path needs a prepaid credit balance the org does not carry — the
first real review run on this PR failed after 435 ms with is_error:true and
zero cost. Use the same secret and the same skip-when-unset gate here so the
two workflows cannot drift apart on how they authenticate.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VzsJf6bUyYZdq3kxJ8DGix
@jacobyoby
jacobyoby merged commit 826e03f into main Sep 11, 2026
1 check passed
@jacobyoby
jacobyoby deleted the ci/claude-on-demand branch September 11, 2026 15:57
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