Skip to content

fix(ci): snapshot release docs from release tag - #1802

Merged
ajbozarth merged 3 commits into
generative-computing:mainfrom
ajbozarth:fix/snapshot-docs-from-release-branch
Nov 10, 2026
Merged

ajbozarth merged 3 commits into
generative-computing:mainfrom
ajbozarth:fix/snapshot-docs-from-release-branch

Conversation

@ajbozarth

@ajbozarth ajbozarth commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Issue

Fixes #1534
Fixes #1437

Description

The snapshot-docs job checked out main when a release was published, so each release's versioned docs and generated API reference reflected main at publish time instead of the released code. This went unnoticed for 0.7.0 and 0.8.0 because their release branches were cut and published within days. release/v0.9 has been open for weeks, and main already has docs for features that won't ship in 0.9.0.

Snapshot fix

  • snapshot-docs checks out the release tag and runs the new .github/scripts/snapshot_docs.sh, which builds the snapshot and opens a chore/docs-snapshot-X.Y.Z sync PR to main, the same pattern as the changelog sync. Merging that PR deploys the docs.
  • lastVersion (the site's default version) only moves when the release is the newest final, so a patch on an older minor doesn't replace the current default.
  • set-last-version.mjs succeeds when lastVersion is already set to the requested version, so retries don't fail.

Release CI cleanup
Several workarounds were written for GITHUB_TOKEN and became unnecessary with the app token switch in #1376. Others were left over from the pre-Docusaurus docs pipeline.

  • docs-publish.yml: removes the release and workflow_dispatch triggers and latest_check, so deploys happen only on push to main. The release trigger caused a redundant deploy from the tag on every release, and force_publish overwrote production from any branch.
  • pypi.yml: triggers on release: published, as v0.1 to v0.6 did. The push: tags trigger never fired for tags created by gh release create, so publishing depended on a dispatch from release.sh. workflow_dispatch stays for manual retries.
  • release.sh: removes the pypi.yml and ci.yml dispatches, since sync PRs opened with the app token already trigger pull_request CI. The callers' unused actions: write permissions are removed too.
  • ci.yml: removes the unused ref dispatch input and its outdated comment. Manual dispatch stays.

zizmor
This resolves all three findings in #1534, leaving zizmor.yml with no ignores:

  • cache-poisoning goes away with the docs-publish release trigger.
  • artipacked goes away because the snapshot checkout no longer persists credentials.
  • excessive-permissions is fixed by adding permissions: {} to dispatch-to-contribs.yml.

Before 0.9.0: this needs a backport to release/v0.9, because publish-release runs the release branch's copy of the workflow.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Ran snapshot_docs.sh end to end against release/v0.9 with a local bare remote and stubbed gh, covering a newest final (updates lastVersion), an older patch (leaves lastVersion unchanged), and a CI retry that reuses an existing sync branch and open PR (completes without a new commit or a second PR). The snapshot matches release/v0.9's docs/docs apart from the generated API and CLI pages. shellcheck, actionlint, and zizmor are clean.

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

The snapshot-docs job built each release's versioned docs from main,
so they included unreleased changes. Build them from the release tag
and land them on main through a sync PR instead.

Also remove release triggers and dispatches made redundant by the
app token switch in generative-computing#1376, and resolve the zizmor findings in generative-computing#1534.

Assisted-by: Claude Code
Signed-off-by: Alex Bozarth <[email protected]>
@ajbozarth
ajbozarth requested a review from a team as a code owner November 10, 2026 01:22
@ajbozarth ajbozarth added chore Housekeeping: renames, comment fixes, dependency bumps, repo hygiene security CVE or vulnerability-driven change labels Nov 10, 2026
@ajbozarth ajbozarth added chore Housekeeping: renames, comment fixes, dependency bumps, repo hygiene security CVE or vulnerability-driven change labels Nov 10, 2026
@ajbozarth ajbozarth self-assigned this Nov 10, 2026
@github-actions github-actions Bot added the bug Something isn't working label Nov 10, 2026

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

see inline

# GITHUB_REPOSITORY (required) — owner/repo

set -euo pipefail
set -x

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.

The script runs git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/..." with tracing on. The trace echoes that command with the token expanded, so only GitHub's log masking protects it.
Fix: remove set -x, or turn it off around the credential handling.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This did come up in my own review and iteration, but as you mentioned GitHub masks it, so I don't see the issue?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

after @AngeloDanducci also mentioned this I took another look and found a better way of doing this that used a safer command, update in 865bccb

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.

Good change 👍

fi

git add "${SNAPSHOT_DOCS}" "${SNAPSHOT_SIDEBAR}" docs/versions.json docs/docusaurus.config.ts
if ! git diff --cached --quiet; then

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.

INFO, lines 68–83: PR creation can fail with nothing to commit.
When git diff --cached --quiet shows no changes, the script skips the commit and push but still runs gh pr create. If the sync branch has no commits ahead of main, or was never pushed, that call fails the job.
The temporary worktree is also never cleaned up.
Fix: exit early when there's nothing to commit, and add a cleanup trap.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I would consider that correct behavior, in that scenario the job should fail and GitHub actions does the clean ups there's no need for a trap

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

On a second look the docs do claim that it should not fail in this scenario, so I added a fix in 865bccb

Snapshots are now built from the release tag, so a fix to a published
snapshot must be made on main to deploy and also landed on the release
branch to carry into the next patch's snapshot.

Assisted-by: Claude Code
Signed-off-by: Alex Bozarth <[email protected]>
@ajbozarth

Copy link
Copy Markdown
Member Author

Just pushed a small docs update to also fully address #1437 which this PR had already nearly addressed in it's entirety.

Also @markstur re-reading my responses to your items above I believe the core factor is the script is in the .github dir and is designed to run within CI workflows and not locally, if I intended them to run locally then we would put them in scripts/ or somewhere else in the project root

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

Generally LGTM, one comment about bonus hardening wrt GH_TOKEN in execution trace when using set -x. Github Actions already obfuscates but can't hurt to be cautious.

Comment thread .github/scripts/snapshot_docs.sh Outdated

git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"

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.

Even though this should be auto masked, should we be extra cautious?

Suggested change
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
{ set +x; } 2>/dev/null
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
set -x

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

As noted in my response to @markstur I took your review and found a different solution in 865bccb

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah I think that's the same solution, but handled differently due to a difference in token availability and source (this script has it in an env var, so the auth command sees it with no extra steps)

Comment thread .github/scripts/release.sh Outdated

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.

Similar comment to the one in snapshot_docs.sh

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was actually why I used that line in the other script, but I also changed this in 865bccb to match my discovered better command

@AngeloDanducci

Copy link
Copy Markdown
Contributor

I see Mark had that same hardening comment 😎

Assisted-by: Claude Code
Signed-off-by: Alex Bozarth <[email protected]>
@ajbozarth

Copy link
Copy Markdown
Member Author

@AngeloDanducci @markstur your items should be resolved if you want to re-review

@ajbozarth
ajbozarth added this pull request to the merge queue Nov 10, 2026
@ajbozarth

Copy link
Copy Markdown
Member Author

Adding to merge queue as is since @AngeloDanducci already approved and I want to get this in and back ported by EOD

Merged via the queue into generative-computing:main with commit 0a087a2 Nov 10, 2026
12 checks passed
@ajbozarth
ajbozarth deleted the fix/snapshot-docs-from-release-branch branch November 10, 2026 22:02
ajbozarth added a commit that referenced this pull request Nov 11, 2026
* fix(ci): snapshot release docs from release tag

The snapshot-docs job built each release's versioned docs from main,
so they included unreleased changes. Build them from the release tag
and land them on main through a sync PR instead.

Also remove release triggers and dispatches made redundant by the
app token switch in #1376, and resolve the zizmor findings in #1534.

Assisted-by: Claude Code


* docs: explain how docs fixes reach release snapshots

Snapshots are now built from the release tag, so a fix to a published
snapshot must be made on main to deploy and also landed on the release
branch to carry into the next patch's snapshot.

Assisted-by: Claude Code


* fix(ci): address review feedback on release scripts

Assisted-by: Claude Code


---------

Signed-off-by: Alex Bozarth <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working chore Housekeeping: renames, comment fixes, dependency bumps, repo hygiene security CVE or vulnerability-driven change

Projects

None yet

3 participants