Skip to content

fix(ci): skip the Claude review when its token is unavailable - #455

Merged
dubadub merged 1 commit into
mainfrom
fix/claude-review-skip-without-token
Aug 15, 2026
Merged

fix(ci): skip the Claude review when its token is unavailable#455
dubadub merged 1 commit into
mainfrom
fix/claude-review-skip-without-token

Conversation

@dubadub

@dubadub dubadub commented Aug 15, 2026

Copy link
Copy Markdown
Member

Problem

Every Dependabot PR has a red claude-review check. The cause is not the code under review:

Secret source: Dependabot
...
##[error]Action failed with error: Environment variable validation failed:
  - Either ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, or workload identity federation ... is required

Dependabot-triggered runs read from the Dependabot secret store, not the Actions one, so secrets.CLAUDE_CODE_OAUTH_TOKEN resolves to an empty string and the action fails validation before it reviews anything. Fork PRs get no secrets either and fail identically.

This is not cosmetic: @dependabot merge waits for CI to pass, so a check that can never pass stalls it indefinitely. That is currently blocking #447, #448, #449, #451, #452 and #453, all of which have fully green Test suites.

Change

Gate the checkout and review steps on the token actually being present. When it isn't, the job skips those steps and succeeds, emitting a ::warning:: so a genuinely misconfigured token is still visible in the run summary rather than silently swallowed.

This deliberately preserves the existing allowed_bots: "dependabot[bot]" intent — reviewing dependency PRs is desirable, it has simply never been able to work. Adding CLAUDE_CODE_OAUTH_TOKEN to the repository's Dependabot secrets (Settings → Secrets and variables → Dependabot) turns the review back on for those PRs, and this workflow then picks it up with no further edit.

Verification

YAML parses and the two gated steps carry the guard; the credential check itself is ungated so the job always reports. Behaviour on this PR is itself the test: it is not a Dependabot PR, so the token is present and claude-review should run and review normally.

Dependabot-triggered runs read from the Dependabot secret store rather than
the Actions one, so CLAUDE_CODE_OAUTH_TOKEN is empty and the action fails
validation:

  Action failed with error: Environment variable validation failed:
    - Either ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, ... is required

That is a check that can never go green on a dependency PR, which leaves
every Dependabot PR permanently red and stalls `@dependabot merge`, since it
waits for CI to pass. Fork PRs get no secrets either and fail the same way.

Gate the review on the token being present, so it skips rather than fails,
and warn in the run summary so a genuinely misconfigured token stays visible.
Adding the token to the repo's Dependabot secrets re-enables the review for
dependency PRs, which is what `allowed_bots: dependabot[bot]` intends.
@dubadub
dubadub merged commit def1aae into main Aug 15, 2026
6 checks passed
@dubadub
dubadub deleted the fix/claude-review-skip-without-token branch August 15, 2026 16:07
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