Skip to content

Simplify ToolHive reference update script to use named release assets#573

Open
rdimitrov wants to merge 1 commit intomainfrom
releases
Open

Simplify ToolHive reference update script to use named release assets#573
rdimitrov wants to merge 1 commit intomainfrom
releases

Conversation

@rdimitrov
Copy link
Member

Description

The following PR updates the update-toolhive-reference.sh script to download named release assets directly instead of downloading and extracting full source tarballs.

Before: Downloaded the full toolhive source tarball (~entire repo) and extracted 3 files from it. Did the same for toolhive-core to get the registry schemas.

After: Downloads only the specific files needed:

  • thv-cli-docs.tar.gz, swagger.yaml, crd-api.md from the toolhive release
  • toolhive-legacy-registry.schema.json, upstream-registry.schema.json, publisher-provided.schema.json from the matching toolhive-core release

The toolhive-core version is still derived from go.mod at the tagged commit (via gh api), preserving the version coupling between the two repos.

Also removes /imports from .gitignore as the temporary extraction directory is no longer used.

Dependencies: Requires stacklok/toolhive release v0.X.Y or later which publishes the named assets (thv-cli-docs.tar.gz, swagger.yaml, crd-api.md).

Type of change

  • New documentation
  • Documentation update
  • Bug fix (typo, broken link, etc.)
  • Navigation/structure change

Related issues/PRs

Screenshots

Submitter checklist

Content and formatting

  • I have reviewed the content for technical accuracy
  • I have reviewed the content for spelling, grammar, and style

Navigation

  • New pages include a frontmatter section with title and description at a minimum
  • Sidebar navigation (sidebars.ts) updated for added, deleted, reordered, or renamed files
  • Redirects added to vercel.json for moved, renamed, or deleted pages (i.e., if the URL slug changed)

Reviewer checklist

Content

  • I have reviewed the content for technical accuracy
  • I have reviewed the content for spelling, grammar, and style

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Copilot AI review requested due to automatic review settings February 24, 2026 23:33
@vercel
Copy link

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs-website Ready Ready Preview, Comment Feb 24, 2026 11:33pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the ToolHive reference update workflow to fetch specific, named GitHub release assets (instead of downloading/extracting full source tarballs) to refresh docs and schema artifacts in this documentation repo.

Changes:

  • Switch scripts/update-toolhive-reference.sh to use gh release download for required assets (CLI docs tarball, swagger, CRD doc, registry schemas).
  • Keep toolhive-core version coupling by deriving it from go.mod at the specified ToolHive tag via gh api.
  • Remove /imports from .gitignore since temporary extraction directories are no longer used.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/update-toolhive-reference.sh Reworks the update script to download named release assets via gh and update docs/schemas directly.
.gitignore Removes the now-unused /imports ignore entry.

Comment on lines +85 to +90
CORE_VERSION=$(gh api "repos/stacklok/toolhive/contents/go.mod?ref=${VERSION}" \
--jq '.content' | base64 -d | grep 'github.com/stacklok/toolhive-core' | awk '{print $2}' | head -1)

if [ -f "${REGISTRY_SCHEMA_SRC}" ]; then
cp ${REGISTRY_SCHEMA_SRC} ${REGISTRY_SCHEMA_DST}
echo "Registry JSON schema updated successfully"
else
echo "Warning: Registry schema not found at ${REGISTRY_SCHEMA_SRC}"
if [ -z "$CORE_VERSION" ]; then
echo "Warning: Could not determine toolhive-core version from go.mod; falling back to latest release"
CORE_VERSION=$(gh release view --repo stacklok/toolhive-core --json tagName --jq '.tagName')
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

With set -euo pipefail, this command substitution will cause the script to exit early if grep finds no match (exit 1) or if any earlier pipe stage fails, so the intended if [ -z "$CORE_VERSION" ] fallback may never run. Adjust this pipeline to tolerate no-match/fetch failures (e.g., make the assignment non-fatal and allow CORE_VERSION to be empty) so the warning + latest-release fallback can execute as written.

Copilot uses AI. Check for mistakes.
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