From aae63f71143690629e4f519cc0fb8ddb63b0f8af Mon Sep 17 00:00:00 2001 From: Pablo Pardo Garcia Date: Wed, 28 Oct 2026 17:45:34 +0100 Subject: [PATCH 1/2] ci: ask glassflow-docs to draft release notes on a version bump When a push to main raises the version in .claude-plugin/plugin.json, dispatch plugin-release with the version, the previous version and the commit. Skips while DOCS_DISPATCH_TOKEN is unset. --- .github/workflows/docs-release-notes.yml | 73 ++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/docs-release-notes.yml diff --git a/.github/workflows/docs-release-notes.yml b/.github/workflows/docs-release-notes.yml new file mode 100644 index 0000000..d036eaa --- /dev/null +++ b/.github/workflows/docs-release-notes.yml @@ -0,0 +1,73 @@ +# Tells glassflow-docs that a new plugin version is live, so its +# release-notes-pr.yml drafts the customer release notes for it (from +# CHANGELOG.md and the commit log) into a PR that a human reviews. +# +# The plugin has no GitHub releases: a version goes live when its version bump +# lands on main, and users get it on their next plugin update. The version in +# .claude-plugin/plugin.json is the authoritative one (CHANGELOG.md: "the +# version in .claude-plugin/plugin.json is what the marketplace installs"). +# .claude-plugin/marketplace.json, the Codex and Cursor manifests and +# pyproject.toml carry the same version, which tests/test_codex_plugin.py +# enforces, so this watches that one file. +# +# Sends repository_dispatch `plugin-release` with {version, previous_version, +# sha} only when the push raised the version (a revert of a bump sends +# nothing). Needs DOCS_DISPATCH_TOKEN, a fine-grained PAT (or GitHub App +# token) with contents:write on glassflow/glassflow-docs, the same secret the +# SDK release workflows use; GITHUB_TOKEN cannot dispatch to another +# repository. Skips with a warning while it is unset. +name: docs-release-notes + +on: + push: + branches: [main] + paths: + - .claude-plugin/plugin.json + +permissions: + contents: read + +jobs: + dispatch: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 # the push's base commit, for the previous version + + - name: Dispatch plugin-release to glassflow-docs + env: + TOKEN: ${{ secrets.DOCS_DISPATCH_TOKEN }} + BEFORE: ${{ github.event.before }} + SHA: ${{ github.sha }} + MANIFEST: .claude-plugin/plugin.json + run: | + set -o pipefail + version=$(jq -r '.version // empty' "$MANIFEST") + previous="" + # A new branch's push has an all-zero base; a force-push's base may + # be gone. Either way there is no previous version to read. + if [[ ! "$BEFORE" =~ ^0+$ ]] && git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then + previous=$(git show "${BEFORE}:${MANIFEST}" 2>/dev/null | jq -r '.version // empty' || true) + fi + echo "manifest version: ${previous:-unknown} -> ${version}" >> "$GITHUB_STEP_SUMMARY" + if [ -z "$version" ] || [ "$version" = "$previous" ]; then + echo "version unchanged; nothing to dispatch" >> "$GITHUB_STEP_SUMMARY" + exit 0 + fi + if [ -n "$previous" ] && [ "$(printf '%s\n%s\n' "$previous" "$version" | sort -V | tail -n1)" != "$version" ]; then + echo "version went down (a reverted bump); nothing to dispatch" >> "$GITHUB_STEP_SUMMARY" + exit 0 + fi + if [ -z "$TOKEN" ]; then + echo "::warning::DOCS_DISPATCH_TOKEN not configured; no release-notes draft requested from glassflow-docs for ${version}." + exit 0 + fi + curl -sS --fail-with-body -X POST \ + -H "Authorization: Bearer $TOKEN" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/repos/glassflow/glassflow-docs/dispatches \ + -d "$(jq -n --arg v "$version" --arg p "$previous" --arg s "$SHA" \ + '{event_type:"plugin-release",client_payload:{version:$v,previous_version:$p,sha:$s}}')" + echo "dispatched plugin-release ${previous:-?} -> ${version} to glassflow-docs" >> "$GITHUB_STEP_SUMMARY" From dc17aa29232d184b1b755d82d58bda9fa0741f74 Mon Sep 17 00:00:00 2001 From: Pablo Pardo Garcia Date: Wed, 28 Oct 2026 17:55:42 +0100 Subject: [PATCH 2/2] ci: read the previous plugin version from the parent when the push base is missing --- .github/workflows/docs-release-notes.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs-release-notes.yml b/.github/workflows/docs-release-notes.yml index d036eaa..1397bec 100644 --- a/.github/workflows/docs-release-notes.yml +++ b/.github/workflows/docs-release-notes.yml @@ -12,10 +12,12 @@ # # Sends repository_dispatch `plugin-release` with {version, previous_version, # sha} only when the push raised the version (a revert of a bump sends -# nothing). Needs DOCS_DISPATCH_TOKEN, a fine-grained PAT (or GitHub App -# token) with contents:write on glassflow/glassflow-docs, the same secret the -# SDK release workflows use; GITHUB_TOKEN cannot dispatch to another -# repository. Skips with a warning while it is unset. +# nothing). Without a readable push base, the previous version is read from +# the pushed commit's parent. Needs DOCS_DISPATCH_TOKEN, a fine-grained PAT +# (or GitHub App token) with contents:write on glassflow/glassflow-docs, the +# same secret the SDK release workflows use; GITHUB_TOKEN cannot dispatch to +# another repository. Skips with a warning while it is unset. + name: docs-release-notes on: @@ -47,10 +49,13 @@ jobs: version=$(jq -r '.version // empty' "$MANIFEST") previous="" # A new branch's push has an all-zero base; a force-push's base may - # be gone. Either way there is no previous version to read. + # be gone. Either way, fall back to the pushed commit's parent. if [[ ! "$BEFORE" =~ ^0+$ ]] && git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then previous=$(git show "${BEFORE}:${MANIFEST}" 2>/dev/null | jq -r '.version // empty' || true) fi + if [ -z "$previous" ]; then + previous=$(git show "${SHA}^:${MANIFEST}" 2>/dev/null | jq -r '.version // empty' || true) + fi echo "manifest version: ${previous:-unknown} -> ${version}" >> "$GITHUB_STEP_SUMMARY" if [ -z "$version" ] || [ "$version" = "$previous" ]; then echo "version unchanged; nothing to dispatch" >> "$GITHUB_STEP_SUMMARY"