Skip to content

feat: extract setup, generate-check, and tag-guard composite actions#23

Merged
dqn merged 13 commits into
mainfrom
feat/extract-managed-steps
Jun 16, 2026
Merged

feat: extract setup, generate-check, and tag-guard composite actions#23
dqn merged 13 commits into
mainfrom
feat/extract-managed-steps

Conversation

@toiroakr

@toiroakr toiroakr commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Extracts the managed-step logic that the SDK setup github templates currently inline into reusable composite actions. This is the "workflow = composition, actions = behavior" split: once the SDK templates reference these, behavior fixes (install tweaks, generate-check rules) ship via a pin bump instead of workflow regeneration.

New composite actions:

  • setup — sets up Node.js (or Bun) and installs dependencies for the selected package manager (package-manager: pnpm/npm/yarn/bun), consolidating the four PM-specific template fragments. Supports an install-command override (for filtered monorepo installs) and node-version-file / working-directory inputs.
  • generate-check — runs tailor-sdk generate and fails if it produces uncommitted changes, catching stale generated files (seed data, enum constants) at PR time.
  • tag-guard — reports whether the pushed tag's commit is reachable from a target branch (on-branch output), so tag-triggered deploys can be limited to tags cut from that branch.

All three are verbatim lifts of logic already shipped in the SDK-generated workflows; the behavior is unchanged, only its home moves.

Testing

The new actions are verbatim lifts of logic already shipped in SDK-generated workflows. End-to-end coverage (package-manager x target, plus generate-check and tag-guard) is exercised by the SDK-side E2E matrix when the templates are wired to these actions; a self-contained smoke test was dropped here to avoid entangling the extraction with this repo's pnpm-version test strategy.

Notes for reviewers

  • Additive only — releases as a v1 minor (e.g. v1.3). Nothing references these actions until the SDK templates are updated.
  • Pairs with a follow-up SDK PR that replaces the inline steps with uses: tailor-platform/actions/{setup,generate-check,tag-guard}@<release-sha>. Released first, then the SDK pins this release (same flow as v1.2 / the previous SDK rework).
  • Checkout stays inline in the generated workflows by design (every job needs the repo + local-action resolution first); these actions assume the caller has checked out (tag-guard needs fetch-depth: 0).

Move the managed-step logic that the SDK 'setup github' templates
currently inline into reusable composite actions, so behavior fixes ship
via a pin bump instead of workflow regeneration:

- setup: Node/Bun + dependency install for pnpm/npm/yarn/bun, selected by
  a 'package-manager' input, with an 'install-command' override.
- generate-check: run tailor-sdk generate and fail on uncommitted output.
- tag-guard: report whether the tag commit is reachable from a branch.

Adds a setup smoke test (pnpm). Full PM x target coverage and
generate-check/tag-guard E2E are handled by the SDK-side test matrix.
The SDK templates are updated to reference these in a follow-up, pinned
to this action's release.
@github-actions

Copy link
Copy Markdown

✅ Tailor Platform Plan (cfa6d5bb-635c-4c56-b903-f52d1822e330)

Plan output (exit code: 0)
No attributes found in configuration

Generated type definitions: tailor.d.ts

Plan: 0 to create, 0 to update, 0 to delete
ℹ Dry run enabled. No changes applied.

pnpm/action-setup and setup-node read the pnpm version and Node version
from package.json; the deploy fixture lacked both, so the setup smoke
test could not resolve them.
@github-actions

Copy link
Copy Markdown

✅ Tailor Platform Plan (6d636d48-ee04-4238-8d2d-a72e12d4a00f)

Plan output (exit code: 0)
No attributes found in configuration

Generated type definitions: tailor.d.ts

Plan: 0 to create, 0 to update, 0 to delete
ℹ Dry run enabled. No changes applied.

pnpm/action-setup reads the pnpm version from the repository root
package.json (not the working-directory), so the root needs a
packageManager field for the setup action to resolve pnpm.
@github-actions

Copy link
Copy Markdown

✅ Tailor Platform Plan (c022124d-14c2-4797-92ee-a963475dc976)

Plan output (exit code: 0)
No attributes found in configuration

Generated type definitions: tailor.d.ts

Plan: 0 to create, 0 to update, 0 to delete
ℹ Dry run enabled. No changes applied.

This comment was marked as outdated.

toiroakr added 5 commits June 15, 2026 21:18
- setup: run install-command via if/else (drop the implicit exit 0) and
  key setup-node caching to the working-directory lockfiles.
- generate-check: detect drift with git status --porcelain instead of
  git add -A, so the index is not mutated.
- tag-guard: normalize a fully-qualified refs/heads/<branch> input to a
  short branch name.
The repo's test workflows pin pnpm via an explicit version input, which
conflicts with a root packageManager field (pnpm/action-setup errors on
multiple specified versions). Rather than entangle the extraction PR
with the repo's pnpm-version strategy, the new actions are exercised by
the SDK-side E2E matrix when the templates are wired to them.
Pointing setup-node's cache-dependency-path at the working-directory
lockfiles breaks the common monorepo layout where a single lockfile
lives at the repo root (the subdir path resolves to nothing and
setup-node errors). The default behavior (auto-detect from root) is
correct for both single-package and root-lockfile monorepo setups.
@toiroakr toiroakr changed the base branch from main to ci/ghalint-zizmor-advisory June 15, 2026 12:52
@github-actions

Copy link
Copy Markdown

✅ Tailor Platform Plan (c87c4c7e-02f3-440c-bed8-ecf430b1dfd3)

Plan output (exit code: 0)
No attributes found in configuration

Generated type definitions: tailor.d.ts

Plan: 0 to create, 0 to update, 0 to delete
ℹ Dry run enabled. No changes applied.

This comment was marked as outdated.

toiroakr added 3 commits June 15, 2026 22:03
For annotated tags GITHUB_SHA can reference the tag object rather than
the commit, and git merge-base --is-ancestor expects commits. Peel with
rev-parse ^{commit} (a no-op for a commit SHA) so the reachability check
is reliable regardless of tag type.
The extraction hard-coded 'npx tailor-sdk generate', which regressed the
SDK template's per-PM exec: for Bun it relied on an ambient Node/npx
being present, and bare npx can silently fall back to fetching a
non-pinned tailor-sdk. Dispatch on a new package-manager input so each
runtime uses its own runner (pnpm exec / yarn / bunx / npx) against the
locally-installed, pinned version.
Add an optional package-manager input to the deploy and plan actions and
resolve a per-PM runner (pnpm exec / yarn / bunx / npx) once, so all
tailor-sdk invocations use it. This stops Bun from depending on an
ambient Node and ensures the locally-installed, pinned tailor-sdk is
used. Defaults to npx when the input is empty, so existing v1.2 callers
are unaffected.
@github-actions

Copy link
Copy Markdown

✅ Tailor Platform Plan (ce3d4a06-1f0a-4678-a5fb-29faaa9a6790)

Plan output (exit code: 0)
No attributes found in configuration

Generated type definitions: tailor.d.ts

Plan: 0 to create, 0 to update, 0 to delete
ℹ Dry run enabled. No changes applied.

The resolved runner written to GITHUB_ENV is one of four fixed literals
selected by a case statement (never user input), so the env-file write
cannot inject code. Annotate the line with a zizmor ignore + rationale.
@github-actions

Copy link
Copy Markdown

✅ Tailor Platform Plan (6c86c6ee-1704-4892-b7b1-415914811dfc)

Plan output (exit code: 0)
No attributes found in configuration

Generated type definitions: tailor.d.ts

Plan: 0 to create, 0 to update, 0 to delete
ℹ Dry run enabled. No changes applied.

zizmor reports the env-file finding at the run: step line, so the
inline ignore must sit there rather than on the echo line.
@github-actions

Copy link
Copy Markdown

✅ Tailor Platform Plan (d78d9351-4e4c-4daf-92a3-9ab34deadc8f)

Plan output (exit code: 0)
No attributes found in configuration

Generated type definitions: tailor.d.ts

Plan: 0 to create, 0 to update, 0 to delete
ℹ Dry run enabled. No changes applied.

@toiroakr toiroakr marked this pull request as ready for review June 15, 2026 14:17
Base automatically changed from ci/ghalint-zizmor-advisory to main June 16, 2026 05:00

@dqn dqn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dqn dqn merged commit 7817f37 into main Jun 16, 2026
5 checks passed
@dqn dqn deleted the feat/extract-managed-steps branch June 16, 2026 05:04
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.

3 participants