ci: install Claude Code CLI directly instead of using the action - #1313
Merged
Conversation
The first version used `uses: anthropics/claude-code-action`, but this repo's Actions policy is allowed_actions: selected with an empty patterns_allowed list (only GitHub-owned actions permitted), so both runs so far (on this PR's own merge, and on the next PR merged after it) died instantly with startup_failure and no jobs at all. Installs the Claude Code CLI via npm and invokes it directly with `claude -p`, using only actions/checkout and actions/setup-node (GitHub-owned, already allowed). Same prompt and --allowedTools as before, verified against the actual installed CLI's --help output rather than assumed. Also confirmed no untrusted field (e.g. PR title, which any fork contributor controls) is spliced directly into a run: shell block - everything relevant is routed through env: first, since this workflow runs with pull_request_target's elevated, secret-bearing permissions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Matches the Twilio runner label already in use by ci.yml, e2e-tests.yml, and release.yml on master, for consistency with the org's runner migration. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Fixes the doc-sync workflow from #1311, which failed with
startup_failureon both runs so far (its own merge, and PR #1300 merging right after): this repo's Actions policy isallowed_actions: selectedwith an emptypatterns_allowedlist — only GitHub-owned actions are permitted, so theuses: anthropics/claude-code-actionreference gets rejected before any job even starts.Rather than requesting an org/repo policy change to allowlist a third-party action, this installs the Claude Code CLI directly (
npm install -g @anthropic-ai/claude-code) and invokes it withclaude -p. The onlyuses:steps left areactions/checkoutandactions/setup-node, both GitHub-owned and already allowed under the current policy. Same prompt and--allowedToolsscope as before; I verified the exact CLI flags against the actual installed binary's--helpoutput rather than assuming.Also double-checked: no attacker-controlled field (e.g. PR title, which any fork contributor sets) is spliced directly into a
run:shell block. This runs withpull_request_target's elevated permissions and secrets, so that matters — everything relevant is routed throughenv:first and referenced as shell variables.Same gating as before:
branches: [master]only, plus a review-decision gate step that skips the run entirely unlessgh pr view --json reviewDecisionreportsAPPROVED.🤖 Generated with Claude Code