Skip to content

ci: install Claude Code CLI directly instead of using the action - #1313

Merged
abueide merged 2 commits into
masterfrom
abueide/claude-doc-sync-cli-install
Aug 26, 2026
Merged

ci: install Claude Code CLI directly instead of using the action#1313
abueide merged 2 commits into
masterfrom
abueide/claude-doc-sync-cli-install

Conversation

@abueide

@abueide abueide commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Fixes the doc-sync workflow from #1311, which failed with startup_failure on both runs so far (its own merge, and PR #1300 merging right after): this repo's Actions policy is allowed_actions: selected with an empty patterns_allowed list — only GitHub-owned actions are permitted, so the uses: anthropics/claude-code-action reference 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 with claude -p. The only uses: steps left are actions/checkout and actions/setup-node, both GitHub-owned and already allowed under the current policy. Same prompt and --allowedTools scope as before; I verified the exact CLI flags against the actual installed binary's --help output 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 with pull_request_target's elevated permissions and secrets, so that matters — everything relevant is routed through env: first and referenced as shell variables.

Same gating as before: branches: [master] only, plus a review-decision gate step that skips the run entirely unless gh pr view --json reviewDecision reports APPROVED.

🤖 Generated with Claude Code

abueide and others added 2 commits August 26, 2026 11:24
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>
@abueide
abueide merged commit 39ee343 into master Aug 26, 2026
11 checks passed
@abueide
abueide deleted the abueide/claude-doc-sync-cli-install branch August 26, 2026 16:44
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