Skip to content

feat(generator): accept any GitHub step field on setup steps - #284

Merged
max-sixty merged 1 commit into
mainfrom
with
Apr 15, 2026
Merged

max-sixty merged 1 commit into
mainfrom
with

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Problem

Previously [[setup]] entries were constrained to {uses, with}, {run}, or {raw}. Needing env, name, shell, or working-directory forced a drop to raw, which can't receive the if: guard injected in tend-notifications — so those steps ran even when the pre-check decided to skip. This is the same bug class #282 fixed for with, just narrower in scope.

Solution

Let a structured [[setup]] entry carry any field from GitHub's step schema: uses, run, name, id, if, with, env, shell, working-directory, continue-on-error, timeout-minutes. Unknown keys fail at config-load with a message listing what's allowed, so typos surface immediately instead of at workflow-parse time.

[[setup]]
uses = "actions/setup-node@v4"
name = "Setup Node"
with = { node-version-file = ".node-version" }
env = { FORCE_COLOR = "1" }

[[setup]]
run = "cargo build --release"
shell = "bash"
working-directory = "./crates/core"
env = { RUSTFLAGS = "-D warnings" }

raw stays as the escape hatch for emitting multiple steps from one entry. A user-supplied if: on a structured step is passed through unchanged in notifications — tend does not stack its guard on top, and emits a warning making that explicit.

Testing

  • New tests: passthrough for env/name/shell/working-directory; user-supplied if: preserved + warning; unknown fields rejected; env must be a table. The existing with test still passes.
  • Full suite: 165 passed.
  • pre-commit run clean.

Not touching

Tend's own .github/workflows/tend-*.yaml — per CLAUDE.md, those track the latest published release and regenerate nightly.

🤖 Generated with Claude Code

Previously `[[setup]]` entries were constrained to `{uses, with}`,
`{run}`, or `{raw}`. Needing `env`, `name`, `shell`, or
`working-directory` forced a drop to `raw`, which can't receive the
`if:` guard injected in `tend-notifications` — so those steps ran even
when the pre-check decided to skip, which is the same bug class that
motivated #282.

Generalize by letting a structured step carry any field from GitHub's
step schema: `uses`, `run`, `name`, `id`, `if`, `with`, `env`, `shell`,
`working-directory`, `continue-on-error`, `timeout-minutes`. Unknown
keys fail at config-load with a message listing what's allowed, so
typos surface immediately instead of at workflow-parse time.

`raw` stays as the escape hatch for emitting multiple steps from one
entry. A user-supplied `if:` on a structured step is passed through
unchanged in notifications — tend does not stack its guard on top; a
warning makes that explicit.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 30d8b67 into main Apr 15, 2026
5 checks passed
@max-sixty
max-sixty deleted the with branch April 15, 2026 18:56
max-sixty added a commit that referenced this pull request Apr 15, 2026
Bumps generator version to 0.0.14 and syncs lockfile.

1 commit since 0.0.13: accept any GitHub step field on setup steps (#284).

Co-Authored-By: Claude <[email protected]>
@max-sixty max-sixty mentioned this pull request Apr 15, 2026
max-sixty added a commit that referenced this pull request Apr 15, 2026
## Summary
- Bumps generator version to 0.0.14 and syncs lockfile.
- 1 commit since 0.0.13: accept any GitHub step field on setup steps
(#284).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Apr 15, 2026
## Why

`raw` was a pre-`with`-support escape hatch for passing parameters to
actions. After #284 structured steps accept every field in GitHub's step
schema (`uses`, `run`, `name`, `id`, `if`, `with`, `env`, `shell`,
`working-directory`, `continue-on-error`, `timeout-minutes`), so the
only thing `raw` still uniquely offered was emitting multiple steps from
one config entry — redundant with writing multiple `[[setup]]` entries.

Two paths in the schema that do almost the same thing but with subtly
different semantics (the `raw` path can't receive the notifications
`if:` guard) is exactly the kind of low-cardinality violation the
project's CLAUDE.md warns against. Collapsing to one canonical form
removes the warning codepath, the `_reindent` helper, and a tradeoff
paragraph in the docs.

## Migration

Anything previously in `raw` becomes either:

1. **Multiple `[[setup]]` entries** — one per step. They render in
declared order.
2. **A local composite action**
(`.github/actions/tend-setup/action.yaml`) referenced with `uses`. This
is the better answer whenever setup has real logic (conditional shells,
shared env, anchored caches) — full YAML, version-controlled, reusable.

`raw` in an existing config now fails at load-time with a message
pointing to both paths, matching tend's "no backward compat, fail clear"
stance.

## Testing

- Replaced the two `test_setup_raw_*` tests with one that confirms the
migration hint is surfaced.
- Full suite: 163 passed.
- `pre-commit run` clean.

## Not touching

Tend's own `.github/workflows/tend-*.yaml` — per `CLAUDE.md`, those
track the latest published release and regenerate nightly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
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