Repository navigation
Conversation
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]>
| # GITHUB_REPOSITORY (required) — owner/repo | ||
|
|
||
| set -euo pipefail | ||
| set -x |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
This did come up in my own review and iteration, but as you mentioned GitHub masks it, so I don't see the issue?
There was a problem hiding this comment.
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
| fi | ||
|
|
||
| git add "${SNAPSHOT_DOCS}" "${SNAPSHOT_SIDEBAR}" docs/versions.json docs/docusaurus.config.ts | ||
| if ! git diff --cached --quiet; then |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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]>
|
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 |
AngeloDanducci
left a comment
There was a problem hiding this comment.
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.
|
|
||
| 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" |
There was a problem hiding this comment.
Even though this should be auto masked, should we be extra cautious?
| 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 |
There was a problem hiding this comment.
fyi a solution using git config is here: https://github.com/generative-computing/mellea-contribs/pull/116/changes#diff-4d69cf4d1836387402d2e9bf76af5ae6f2f98ed83ac542bda3bd1e8d48865060R274
but at first glance yours looks nicer. I just haven't looked close yet.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Similar comment to the one in snapshot_docs.sh
There was a problem hiding this comment.
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
|
I see Mark had that same hardening comment 😎 |
Assisted-by: Claude Code Signed-off-by: Alex Bozarth <[email protected]>
|
@AngeloDanducci @markstur your items should be resolved if you want to re-review |
|
Adding to merge queue as is since @AngeloDanducci already approved and I want to get this in and back ported by EOD |
0a087a2
* 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]>
Issue
Fixes #1534
Fixes #1437
Description
The
snapshot-docsjob checked outmainwhen a release was published, so each release's versioned docs and generated API reference reflectedmainat 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.9has been open for weeks, andmainalready has docs for features that won't ship in 0.9.0.Snapshot fix
snapshot-docschecks out the release tag and runs the new.github/scripts/snapshot_docs.sh, which builds the snapshot and opens achore/docs-snapshot-X.Y.Zsync PR tomain, 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.mjssucceeds whenlastVersionis already set to the requested version, so retries don't fail.Release CI cleanup
Several workarounds were written for
GITHUB_TOKENand became unnecessary with the app token switch in #1376. Others were left over from the pre-Docusaurus docs pipeline.docs-publish.yml: removes thereleaseandworkflow_dispatchtriggers andlatest_check, so deploys happen only on push tomain. Thereleasetrigger caused a redundant deploy from the tag on every release, andforce_publishoverwrote production from any branch.pypi.yml: triggers onrelease: published, as v0.1 to v0.6 did. Thepush: tagstrigger never fired for tags created bygh release create, so publishing depended on a dispatch fromrelease.sh.workflow_dispatchstays for manual retries.release.sh: removes thepypi.ymlandci.ymldispatches, since sync PRs opened with the app token already triggerpull_requestCI. The callers' unusedactions: writepermissions are removed too.ci.yml: removes the unusedrefdispatch input and its outdated comment. Manual dispatch stays.zizmor
This resolves all three findings in #1534, leaving
zizmor.ymlwith no ignores:cache-poisoninggoes away with thedocs-publishreleasetrigger.artipackedgoes away because the snapshot checkout no longer persists credentials.excessive-permissionsis fixed by addingpermissions: {}todispatch-to-contribs.yml.Before 0.9.0: this needs a backport to
release/v0.9, becausepublish-releaseruns the release branch's copy of the workflow.Testing
Ran
snapshot_docs.shend to end againstrelease/v0.9with a local bare remote and stubbedgh, covering a newest final (updateslastVersion), an older patch (leaveslastVersionunchanged), and a CI retry that reuses an existing sync branch and open PR (completes without a new commit or a second PR). The snapshot matchesrelease/v0.9'sdocs/docsapart from the generated API and CLI pages. shellcheck, actionlint, and zizmor are clean.Attribution
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.
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.