Skip to content

chore: consolidate Claude CI setup into composite action - #1273

Merged
max-sixty merged 1 commit into
mainfrom
chore/consolidate-claude-ci-setup
Mar 5, 2026
Merged

chore: consolidate Claude CI setup into composite action#1273
max-sixty merged 1 commit into
mainfrom
chore/consolidate-claude-ci-setup

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Extracts 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
  • Updates the claude-renovate prompt to reference the composite action as the canonical location for tool version pins

Net 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
Workflow Before After Change
claude-ci-fix 4 setup steps 1 composite action call -13 lines
claude-issue-triage 4 setup steps 1 composite action call -13 lines
claude-mention 4 setup steps 1 composite action call -13 lines
claude-nightly-cleaner 4 setup steps 1 composite action call -13 lines
claude-nightly-review-reviewers 4 setup steps 1 composite action call -13 lines
claude-review 4 conditional steps 1 conditional composite action call -15 lines
claude-renovate 1 cache step 1 composite action call (tools+shells disabled) ±0 lines

Closes the follow-up from #1271.

Test plan

  • Workflow YAML is valid (no syntax errors from gh push)
  • Next Claude CI run on any workflow confirms the composite action works

🤖 Generated with Claude Code

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
max-sixty enabled auto-merge (squash) March 5, 2026 03:01
@max-sixty
max-sixty merged commit aa46fe5 into main Mar 5, 2026
22 checks passed
@max-sixty
max-sixty deleted the chore/consolidate-claude-ci-setup branch March 5, 2026 03:10
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>
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>
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.

2 participants