Skip to content

fix(generator): support with: on uses setup steps - #282

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-281
Apr 15, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-281

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Problem

The tend-notifications workflow fails when there are no notifications to process and the repo configures a parameterized setup action like actions/setup-node@v4.

_setup_yaml() only adds the if: guard to uses and run step types. A raw step gets rendered verbatim (by design — it's verbatim YAML), which means actions that need with: parameters — forced into raw because the old uses step type didn't support with — run even when the pre-check decided to skip. With checkout also skipped, .node-version doesn't exist and setup-node fails.

Solution

Accept with = {...} alongside uses in [[setup]] and render it as a nested YAML block. This lets parameterized actions use the uses step type and receive the if: guard normally:

[[setup]]
uses = "actions/setup-node@v4"
with = { node-version-file = ".node-version" }

with on run/raw steps is rejected with a clear error.

raw is still supported for fall-back cases (injecting multiple steps, step-level shell:/env:), and the example config now nudges toward uses + with for anything it can express.

Testing

  • New test test_setup_uses_with_parameters_gets_if_guard reproduces the bug: before the fix it asserted None == {'node-version-file': '.node-version'} because the with key was silently dropped by the config parser. It now passes and also confirms the rendered step has the if: guard.
  • Full test suite: 160 passed.
  • pre-commit run clean on touched files.

Not touching

Tend's own .github/workflows/tend-*.yaml — per CLAUDE.md, those track the latest published release and regenerate nightly. The gap between this generator change and the next release is expected.


Closes #281 — automated triage

Actions that take parameters (e.g. `actions/setup-node@v4` with
`node-version-file`) previously had to be expressed as `raw` YAML.
`_setup_yaml()` can't add the `if:` guard to raw steps, so when the
notifications workflow's pre-check decided to skip (no notifications to
process), the raw setup-node step still ran — and failed with "The
specified node version file does not exist" because checkout was
skipped.

Accept `with = {...}` alongside `uses` in `[[setup]]`, render it as a
nested YAML block, and keep the `if:` guard. Reject `with` on `run`/`raw`
steps with a clear error.

Closes #281

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit b26c01b into main Apr 15, 2026
3 checks passed
@max-sixty
max-sixty deleted the fix/issue-281 branch April 15, 2026 18:04
max-sixty added a commit that referenced this pull request Apr 15, 2026
Bumps generator version to 0.0.13 and syncs lockfile.

6 commits since 0.0.12: generator fix for `with:` on `uses` setup steps (#282),
release workflow now regenerates tend's own workflows after PyPI (#275), plus
docs and skills updates (#277, #272, #271).

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
Bumps generator version to 0.0.13 and syncs lockfile.

6 commits since 0.0.12:
- fix(generator): support `with:` on `uses` setup steps (#282)
- fix(release): regenerate tend's own workflows after PyPI release
(#275)
- docs: explain workflow overrides and test skip-review-label example
(#277)
- docs(readme): note on Claude subscription & OAuth tokens (#272)
- skills(review-reviewers): document bot-self-trigger as non-issue
(#271)
- chore: regenerate workflows with tend 0.0.12 (#273)

> _This was written by Claude Code on behalf of Maximilian_

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Apr 15, 2026
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 added a commit that referenced this pull request Apr 15, 2026
## 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.

```toml
[[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](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.

notifications: setup-node fails when raw step can't receive if guard

2 participants