chore: consolidate Claude CI setup into composite action - #1273
Merged
Conversation
Extract the repeated cargo-insta, cargo-nextest, rust-cache, and shell installation steps from all 7 claude-* workflows into a single composite action at .github/actions/claude-setup/action.yaml. Each workflow now calls the composite action in one step instead of duplicating 4 setup steps. The action supports `install-cargo-tools` and `install-shells` boolean inputs (both default to true) for workflows like claude-renovate that only need the cache. Net reduction: ~90 lines. Tool version pins are now in one place. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
max-sixty
enabled auto-merge (squash)
March 5, 2026 03:01
This was referenced Mar 5, 2026
worktrunk-bot
added a commit
that referenced
this pull request
Mar 5, 2026
The composite action `.github/actions/claude-setup` only exists on main. When `claude-mention` or `claude-review` checks out a PR branch created before #1273, the action directory disappears and the step fails. Move "Setup build tools" before the PR branch checkout steps. The action installs cargo tools and caches — none depend on PR branch content. Fixes #1275 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 tasks
max-sixty
pushed a commit
that referenced
this pull request
Mar 5, 2026
## Summary - Moves "Setup build tools" step **before** PR branch checkout in `claude-mention` and `claude-review` workflows - The composite action (`.github/actions/claude-setup`) only exists on `main` — checking out a PR branch created before #1273 removes it, causing the step to fail - Also adds `if: steps.verify.outcome != 'failure'` guard to the setup step in `claude-mention` (was missing) **Failed runs:** [22703855403](https://github.com/max-sixty/worktrunk/actions/runs/22703855403), [22703814015](https://github.com/max-sixty/worktrunk/actions/runs/22703814015) (both triggered on PR #1225) Fixes #1275 ## Test plan - [ ] Trigger `claude-mention` on PR #1225 (which predates #1273) and verify the setup step succeeds - [ ] Verify `claude-review` `pull_request_review` path still works 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
max-sixty
pushed a commit
to max-sixty/tend
that referenced
this pull request
May 8, 2026
…ntions (#391) ## Problem `tend-mention` triggered from an `issue_comment` (or `pull_request_review*` event) on a PR whose head branch predates a local composite action referenced by `setup` fails before the agent boots. The current step order is: 1. `actions/checkout@v6` (default branch) 2. `Check out PR branch` → `gh pr checkout <N>` switches HEAD to the PR branch 3. `uses: ./.github/actions/<setup>` → resolves against the *PR's* tree If the PR is old enough that its tree doesn't yet contain that action (a long-lived external PR opened before the action was added, or a stale PR never rebased), step 3 fails with `Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/<repo>/<repo>/.github/actions/<name>'. Did you forget to run actions/checkout before running your local action?`. The maintainer's `@bot ...` request drops silently with a red CI X; the agent never runs. ## Repro `max-sixty/worktrunk` run [25452024590](https://github.com/max-sixty/worktrunk/actions/runs/25452024590) on PR [#1256](max-sixty/worktrunk#1256) (`feat/add-az-support`, opened 2026-03-04 by an external contributor). Comment: `@worktrunk-bot yes, let's try a fresh implementation, push to this PR please`. The local `./.github/actions/claude-setup` was added 2026-03-05 in worktrunk PR [#1273](max-sixty/worktrunk#1273), one day after PR #1256 was opened. PR #1256 has not been rebased, so its head ref's tree lacks that action. `gh pr checkout 1256` then `uses: ./.github/actions/claude-setup` → 404. ## Fix Run `setup` against the default branch (right after the initial `actions/checkout@v6`) and *then* `gh pr checkout` to switch to the PR branch. Local actions referenced by `setup` always resolve from default-branch state, regardless of how stale the PR is. The agent still sees the PR-branch tree because the PR-branch checkout follows setup; tools installed by setup (uv, bun, cargo crates, apt packages) persist in the runner env across the `git switch` and remain available to the agent and any post-checkout steps. A short comment in the generated YAML calls out the constraint so future edits don't reverse the order. ## Tradeoffs The previous test (`test_setup_after_pr_checkout_in_mention`) asserted the inverted contract — setup *after* PR checkout — to give setup steps PR-branch state (e.g. cache prefixes hashing PR's `Cargo.lock`). The cost of that contract is that any local-action-referencing setup breaks on long-lived stale PRs, and breaks them silently. Reversing the contract trades a minor cache-key miss (cargo/rust-cache handles this internally) for a workflow that always runs. The renamed test (`test_setup_before_pr_checkout_in_mention`) carries the rationale in its docstring so the next reader understands why this ordering matters. ## Scope `tend-mention` only — `tend-review` (and the other workflows) check out the PR head directly via a single `actions/checkout` and don't have the two-step main-then-PR sequence. `tend-review` on a conflicting + stale PR could in principle hit a related shape, but `tend-review` is gated by `pull_request_target` events ([opened, synchronize, ready_for_review, reopened]) — a stale PR that hasn't been synchronized since the action was introduced won't fire the workflow. Out of scope here. ## Tests `generator/`: `uv run pytest` — 188 passed. Regtest snapshots regenerated for the two `mention` outputs. ## Evidence [Evidence gist](https://gist.github.com/9675d1510da32c68a68c1d45137b21e0) — first occurrence of this specific shape recorded in this run; classified Critical (1 occurrence sufficient — clearly wrong outcome dropping a maintainer's explicit request) + Structural (deterministic action-resolution against checked-out tree). --------- Co-authored-by: tend-agent <270458913+tend-agent@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 <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.
Summary
claude-*workflows into a single composite action at.github/actions/claude-setup/action.yamlclaude-renovateprompt to reference the composite action as the canonical location for tool version pinsNet change: -88 lines (146 removed, 58 added). Tool version pins are now in one place — future version bumps update 1 file instead of 7.
Per-workflow changes
Closes the follow-up from #1271.
Test plan
ghpush)🤖 Generated with Claude Code