Repository navigation
nightly: include version bump and diff stat in workflow-update PR body - #314
tend-agent wants to merge 2 commits into
Conversation
Extract the pinned tend version (if any) from the workflow YAML before and after regeneration, and surface the delta alongside a `git diff --stat` summary in the PR title/body. Falls back to omitting the version line when no version pin is embedded (the current state, since templates use `uvx tend@latest` and `max-sixty/tend@v1`) or when both sides match. Addresses #313. Co-Authored-By: Claude Opus 4.7 <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
One structural concern on the cross-block state dependency — see inline. The regex and title/body rendering themselves look correct, and the issue is latent until templates pin a tend version, but worth addressing now so the feature actually fires when it's needed.
| PR: | ||
|
|
||
| `````bash | ||
| NEW_VER=$(extract_tend_version) |
There was a problem hiding this comment.
NEW_VER=$(extract_tend_version) and the [ -n "$OLD_VER" ] condition reference the function and variable defined in the earlier bash block. Per the running-in-ci skill and CLAUDE.md, shell state doesn't persist between bash tool calls — so when the agent runs this as a separate invocation from block 1 (the natural pattern, since git status output drives the branch), both are gone. OLD_VER reads as empty, extract_tend_version is undefined, and the version-bump line never renders.
Latent today because the current workflow templates use uvx tend@latest — so OLD_VER/NEW_VER are always empty and the fallback path runs correctly either way. But once a version gets pinned in the templates, the feature would silently no-op.
Two fixes: (1) consolidate into one script with an if around the PR-creation branch so everything runs in one bash call; or (2) stash OLD_VER to a temp file in block 1 (echo "$OLD_VER" > "$TMPDIR/tend-old-ver") and re-source it plus redefine extract_tend_version here.
There was a problem hiding this comment.
Good catch — fixed in de974f7. Took option 2: OLD_VER is now stashed to $TMPDIR/tend-old-ver in block 1 and read back in block 3, and the grep is inlined at both extraction sites rather than wrapped in a function (since the function can't survive the bash boundary either).
…ndary Shell state doesn't persist between Bash tool calls, so `OLD_VER` and `extract_tend_version` defined in the capture block would be gone when the PR-creation block ran as a separate invocation. Latent today because the templates use `uvx tend@latest`, but would silently no-op once a version gets pinned. Write OLD_VER to $TMPDIR/tend-old-ver in block 1 and read it back in block 3; inline the grep at both extraction sites instead of defining a function. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
another option is to write out the version into the generated files; could we do that? |
|
Yes — the generator knows its own version via A few things worth weighing:
Happy to redirect if you'd like me to go that way. |
|
yes, let's pursue that |
|
Closing in favor of the header-stamp approach. Will open a replacement PR that adds |
## Summary
- Stamp the running tend version into every generated workflow header:
`# Generated by tend 0.0.16.` instead of `# Generated by tend.`, via
`importlib.metadata.version("tend")` in
`generator/src/tend/workflows.py`.
- Update `plugins/tend-ci-runner/skills/nightly/SKILL.md` Step 6 to read
that anchor from the workflow YAML before and after `uvx tend@latest
init`, surface the bump in the PR title (`chore: update tend workflows
(A → B)`), and include a `git diff --stat` summary in the body.
- Anchor is stable regardless of what templates pin for `uvx tend@…` or
the `max-sixty/tend@v1` action tag, so detection works on tend itself
(where neither template embeds a concrete version today) and on
downstream repos that pin to `latest`.
- Pre-stamp workflows produce an empty `OLD_VER`; renderer omits the
version line when either side is empty or both sides match, so the
transitional regen (before / after this ships) won't print `unknown →
0.0.17`.
- Closes #313. Supersedes #314
([discussion](#314 (comment))).
## Test plan
- [ ] `uv run pytest` in `generator/` — 164 passed (regtest snapshots
refreshed for all 8 workflows × minimal + with-setup parameterizations).
- [ ] `pre-commit run` on touched files — trim whitespace, ruff, typos,
bang-backtick guard all pass.
- [ ] End-to-end: first nightly run after this ships stamps the
regenerated workflows with the published version; the subsequent nightly
(once the publish has made `uvx tend@latest` carry this change) will be
the first to show `A → B` when tend is bumped.
---------
Co-authored-by: tend-agent <[email protected]>
Co-authored-by: Claude Opus 4.7 <[email protected]>
Summary
plugins/tend-ci-runner/skills/nightly/SKILL.mdStep 6, extract the pinned tend version from workflow YAML before and afteruvx tend@latest init, and surface the bump in the PR title (chore: update tend workflows (A → B)) plus body.git diff --stat .github/workflowssummary in the body so maintainers can see which files changed without opening the diff.uvx [email protected]andtend==X.Y.Zmarkers; when either side is empty or both match, the title and body omit the version line (matches the current state where templates useuvx tend@latestandmax-sixty/tend@v1).Addresses #313.
Test plan
uvx [email protected] init→1.2.3,tend==0.0.16→0.0.16,uvx tend@latest init→ empty.0.0.15 → 0.0.16), same version, and empty detection — only the bump case adds the suffix.pre-commitrun on the modified skill: passes (trim-whitespace, typos, bang-backtick guard).