ci: hoist Claude review env to job-level and externalize base URL#22
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes in one
1. Move env vars from step-level to job-level
`anthropics/claude-code-action@v1` is a composite action, and step-level `env:` on the action invocation does not propagate to a composite action's internal sub-steps. The action's env validation runs inside one of those sub-steps, sees `ANTHROPIC_API_KEY` empty, and bails with "Environment variable validation failed". Hoisting the env to job-level fixes the propagation.
Verified diagnosis: in the failing runs, the env block showed `ANTHROPIC_API_KEY: ***` on the action's top-level invocation but `ANTHROPIC_API_KEY:` (blank) on the inner step where validation runs.
2. Externalize the base URL to a repo secret
Moves the Claude review endpoint from a literal value in the workflow file into the `ANTHROPIC_BASE_URL` repo secret. Cleaner separation of config from code, and lets the endpoint be swapped without code changes.
Verification plan
This PR itself will hit the workflow-validation skip (because it modifies the workflow file). After merge, push an empty commit to `test/claude-review-smoke` to retrigger PR #21, where the action will run for real against the new main and should both pass and post a review comment.