Skip to content

refactor(generate): route all setup-cli emissions through one emitter - #652

Merged
joshua-temple merged 1 commit into
mainfrom
refactor/unify-setup-cli-emitter
Jul 21, 2026
Merged

refactor(generate): route all setup-cli emissions through one emitter#652
joshua-temple merged 1 commit into
mainfrom
refactor/unify-setup-cli-emitter

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

The generator emits the "Setup CLI" step (uses: stablekernel/cascade/.github/actions/setup-cli@<ref> plus its inputs) from 16 scattered sites across internal/generate/, with no shared emitter. A planned --cli-install=action|binary flag (#651) needs one place to branch the install method; today it would have to touch every site.

Fix

Route every setup-cli emission through one canonical emitter, writeSetupCLIStep in internal/generate/setup_cli.go, driven by a small setupCLIStep descriptor (ref, version, token, tokenBeforeVersion, ifExpr). Ref resolution stays with each caller, so behavior is unchanged. Output is byte-identical.

Verification

  • go build ./..., go test ./... (3655 passed / 37 packages), go test -race ./internal/generate/, golangci-lint run ./... all clean.
  • Regenerated cascade's own workflows (generate-workflow --own-repo): zero working-tree drift, confirming byte-identical generated output.
  • Independent cascade-reviewer pass: APPROVE, with its own drift regeneration.

Prep for #651; no behavior change.

Collapse the 15 scattered sites that print the setup-cli composite-action
step into a single writeSetupCLIStep helper. Each generator keeps its own
getCLIRef/GetCLIVersion resolution and passes the resolved values plus the
token, input ordering, and optional step-level if guard. Generated output is
byte-identical.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit 4509b0e into main Jul 21, 2026
21 checks passed
@joshua-temple
joshua-temple deleted the refactor/unify-setup-cli-emitter branch July 21, 2026 17:01
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