Skip to content

Use toolhive-actions to build and publish skills - #7273

Merged
samuv merged 2 commits into
mainfrom
t3/use-toolhive-actions-skills
Nov 24, 2026
Merged

samuv merged 2 commits into
mainfrom
t3/use-toolhive-actions-skills

Conversation

@samuv

@samuv samuv commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

skills-build.yml and skills-publish.yml each manage their own thv serve lifecycle and run a hand-written build/push loop. That is the job StacklokLabs/toolhive-actions skills-publish (v0.0.9) was written for. Switching to it makes toolhive the first real consumer of those actions. It also adds a gate the loop never had: a skill with validation errors now fails CI before anything is built.

What gets published doesn't change: the same references, the same keyless signing, and the same signer identity.

  • Both workflows still build thv from source, so a PR tests its own validator and builder. The binary goes on PATH and the workflows call the action, pinned by SHA. The thv serve start/stop steps and the loops are removed.
  • skills-build.yml calls the action with push: 'false' and keeps only contents: read.
  • skills-publish.yml calls it with push: 'true'. The tags are the computed tag and, on release tags only, latest on a second line, which the action pushes last. The ghcr login and the packages: write and id-token: write permissions stay.
  • The registry prefix is now ghcr.io/${github.repository,,}/skills instead of being hard-coded. On stacklok/toolhive it is still ghcr.io/stacklok/toolhive/skills.
  • renovate.json takes StacklokLabs/toolhive-actions out of the grouped GitHub Actions PR and holds each new release for 3 days before proposing it.
  • docs/arch/12-skills-system.md now describes the action in its "In CI" section, and still explains why build and publish are separate workflows.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe): CI: adopt the toolhive-actions skills-publish action for building and publishing skills

Test plan

  • Linting (task lint-fix): 0 issues. actionlint shows no findings in the changed files other than the existing $/ self-repository syntax, which the installed actionlint doesn't recognize yet. renovate-config-validator --strict (latest) passes.
  • Manual testing (described below)

Locally, against the action at the pinned commit:

  • thv skill validate skills/toolhive-cli-user returns {"valid": true}, with no errors or warnings, so the new gate passes.
  • Ran the "Compute tags" step for refs/tags/v0.69.0 (result: v0.69.0, then latest) and for refs/pull/1/merge (result: the computed tag only).
  • Ran the action's version gate. A thv stamped v0.69.0 passes. A plain go build reports build-<sha> and is refused, which is why the publish workflow needs the ldflags.

End-to-end publish on a personal fork (the publish path can't run from a PR):

  • The test commit was this PR's first commit plus a temporary caller, not committed here. The caller ran on pushing tag v9.9.9-test and called ./.github/workflows/skills-publish.yml with packages: write and id-token: write. I used a tag push rather than workflow_dispatch because dispatch needs the workflow on the fork's default branch. push is one of the action's trusted events, and GITHUB_REF was refs/tags/v9.9.9-test, as on a release.
  • The run succeeded. It validated the skill, built ghcr.io/samuv/toolhive/skills/toolhive-cli-user:v9.9.9-test and :latest, then pushed :v9.9.9-test followed by :latest.
  • thv skill install … --scope project for both tags installed the skill as signed. The lock entries show signerIdentity: /.github/workflows/skills-publish.yml, certIssuer: https://token.actions.githubusercontent.com, repositoryRef: refs/tags/v9.9.9-test and runnerEnvironment: github-hosted.
  • Compared with the current upstream ghcr.io/stacklok/toolhive/skills/toolhive-cli-user:latest, the provenance fields have the same shape and the same signerIdentity. The digest is identical (sha256:02b0266b…), so the action's build is byte-for-byte the same as the old loop's.
  • I deleted the test tag and branch from the fork afterwards.

Does this introduce a user-facing change?

No. The published references (ghcr.io/stacklok/toolhive/skills/<name>:<tag>, plus :latest on releases) and the keyless signer identity are unchanged. The workflow files keep their names and paths, so job_workflow_ref and the signer pinned in consumers' toolhive.lock.yaml stay the same.

Contributors will notice two differences in CI:

  • A PR whose skill has validation errors now fails Build Skills.
  • Before, a directory under skills/ without a SKILL.md failed thv skill build and turned the job red. Now the action skips it with a ::warning:: annotation and the job stays green, so that skill is not published.

Special notes for reviewers

  • ldflags on the publish build. publish.sh refuses to push unless thv version --format json reports v0.48.0 or later. A plain go build reports a development version, so skills-publish.yml sets -X github.com/stacklok/toolhive/pkg/versions.Version=${TAG}, the variable the Taskfile and goreleaser set. Release tags are vX.Y.Z, so they pass. The version doesn't go into the artifacts; the fork test produced the same digest as the current upstream release. skills-build.yml doesn't set it because it never pushes.
  • New validation gate on PRs. The action validates with the same checks as skill-validate and fails on errors. Warnings only show as annotations; the action's fail-on-warnings is hard-coded off. I didn't add a separate strict skill-validate step, because it would run the same checks twice. A warnings gate fits better in the skill-refs/skill-budget follow-up.
  • SHA pin and Renovate. The action is pinned to 2a20e956503d8878c219b2d2b7d91bdf89d731b4 (v0.0.9). It runs in the releaser job with id-token: write and starts the thv serve that receives the OIDC token. So each bump gets its own PR instead of joining the weekend "github actions" group, and Renovate waits 3 days after a release (minimumReleaseAge) before proposing it.
  • Derived registry prefix. Lowercasing github.repository gives exactly the old value upstream. On a fork it points the publish at the fork's own ghcr, which is how the fork test ran the committed workflow unchanged.
  • Push order. Both the old loop and the action build each skill once per tag. What changed is the order of pushes. The old loop pushed :<tag> and then :latest one skill at a time. The action pushes the versioned tag for every skill first, then latest for every skill, so latest moves only after the release tag has been published for all of them.
  • Known limitation, already present before this PR. releaser.yml has no concurrency group, so two overlapping releases could move latest back to the older release. I left it out on purpose: GitHub keeps only one pending run per group, so a third queued release would silently cancel the second's publish. Releases rarely overlap during the few minutes this job runs.
  • Side observation, unrelated to this PR. Upstream :latest currently installs with repositoryRef: refs/tags/v0.59.0, even though skills publishing succeeded on every release since. The skill's digest hasn't changed since then, and thv records the provenance of the first signature found on that digest.
  • Out of scope: skill-refs/skill-budget (follow-up PR), plugins (toolhive has no plugins/), and skills-keyless-signing-e2e.yml, which is unchanged.

🤖 Generated with Claude Code

The skills workflows hand-rolled a thv serve lifecycle and a build/push
loop that StacklokLabs/toolhive-actions now provides as the
skills-publish action. Calling it makes toolhive the first real consumer
of those actions and adds a validation gate that fails on skill errors
before anything is built.

Published references, keyless signing and the signer identity are
unchanged: the workflow files keep their names and paths, the registry
prefix still resolves to ghcr.io/stacklok/toolhive/skills, and latest is
still added only on release tags, now pushed after the versioned tag.

The publish workflow stamps the release tag into thv with ldflags,
because the action refuses to push with a thv older than v0.48.0 and a
plain build reports a development version. Renovate opens a separate PR
for each toolhive-actions bump, since that action runs with the release
job's OIDC signing token.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
@samuv
samuv requested a review from ChrisJBurns as a code owner November 24, 2026 15:38
@samuv
samuv marked this pull request as draft November 24, 2026 15:38
@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label Nov 24, 2026
@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.85%. Comparing base (44f7d63) to head (e56f71c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7273      +/-   ##
==========================================
- Coverage   81.88%   81.85%   -0.04%     
==========================================
  Files         915      915              
  Lines       92769    92853      +84     
==========================================
+ Hits        75966    76005      +39     
- Misses      16798    16843      +45     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samuv
samuv marked this pull request as ready for review November 24, 2026 15:53
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Nov 24, 2026
@samuv samuv self-assigned this Nov 24, 2026
peppescg
peppescg previously approved these changes Nov 24, 2026

@peppescg peppescg 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.

Thanks Samuele, this is a clean switch and the fork test with an identical digest is very convincing.

What I checked:

  • The action at 2a20e95 (v0.0.9) is plain bash and calls no other actions, so the SHA pin covers everything that runs with the release job's OIDC token. The points I raised on toolhive-actions #26 are all addressed there: an owned thv serve when pushing, escaped annotations, one tag at a time with latest last, and separate skills/plugins keys in references-json.
  • releaser.yml runs on release: published, and a called workflow sees the caller's event, so release passes the action's trusted-event check even though the fork test used a tag push.
  • The Version ldflag matches the Taskfile and goreleaser, and TAG is already checked against VERSION by verify-release. The stamped version doesn't trigger update checks in CI (ShouldSkipUpdateChecks honours GITHUB_ACTIONS/CI).
  • The Build Skills log on this PR shows the validation gate running (0 errors, 0 warnings) and an owned daemon on a free port.

A few non-blocking notes, two of them inline:

  • PR body nit: "Each skill is now built once per tag rather than rebuilt for latest" describes the old loop too, which also built once per tag. What changed is the push order.
  • Nit: the "Compute registry prefix" step is duplicated in both workflows. That's fine at two lines, just mentioning it.

🤖 Generated with Claude Code

Comment thread renovate.json Resolved
Comment thread docs/arch/12-skills-system.md Resolved
Hold toolhive-actions bumps for three days before Renovate proposes
them, since the action runs with the release job's signing identity,
and document that a skills/ directory without SKILL.md is now skipped
with a warning instead of failing the build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Nov 24, 2026

@peppescg peppescg 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.

Thanks for the quick follow-up. minimumReleaseAge is in, the skip-without-SKILL.md behaviour is documented in the arch doc and the PR body, and the push-order wording is clear now. Re-approving on e56f71c.

🤖 Generated with Claude Code

@samuv
samuv merged commit 2aa1b41 into main Nov 24, 2026
80 of 81 checks passed
@samuv
samuv deleted the t3/use-toolhive-actions-skills branch November 24, 2026 16:42
@github-actions github-actions Bot mentioned this pull request Nov 24, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants