fix(fern): hydrate frozen version content in docs CI - #564
Merged
Conversation
fern/versions/vX.Y.Z.yml is committed, but the pages it names live under fern/versions/vX.Y.Z-content/, which is extracted from the matching chart tag at build time and never committed. publish-fern-docs.yml and fern-docs-preview-build.yml both did that extraction inline; fern-docs-ci.yml did not, so fern docs md check failed with a bare ENOENT on the first PR that registered a version. Extract the shared block to scripts/hydrate-fern-versions.sh and call it from all three workflows. The CI checkout gains fetch-tags so git archive can reach the tags, and the step sits after Check MDX safety so that grep keeps scanning live docs/ only -- frozen content cannot be edited, so a hit in it would fail the job with no source left to fix. Also stop the registration PR from committing a file out of the ephemeral content directory. Git pathspec wildcards cross / unless :(glob) magic is used, so add-paths: fern/versions/v*.yml also matched fern/versions/v0.19.0-content/index.yml. Tighten the pathspec and gitignore the content directories so it cannot recur either way. Fixes #563 Signed-off-by: Alex Yuskauskas <ayuskauskas@nvidia.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #563.
Problem
fern/versions/vX.Y.Z.ymlis committed, but the pages it names live underfern/versions/vX.Y.Z-content/— build artifacts extracted from the matchingchart/vX.Y.Ztag and never committed. Two of the three Fern workflows extracted them inline;fern-docs-ci.ymldid not, so the first PR to register a version (#561) failed with:Separately, that registration PR committed
fern/versions/v0.19.0-content/index.yml, which should never be tracked. Git pathspec wildcards cross/unless:(glob)magic is used, soadd-paths: fern/versions/v*.ymlreached one directory deeper.Changes
scripts/hydrate-fern-versions.sh— the extraction block, which was duplicated verbatim inpublish-fern-docs.ymlandfern-docs-preview-build.yml(only the error wording differed). Both now call it, as doesfern-docs-ci.yml.fern-docs-ci.yml— gains the hydration step andfetch-tags: trueon its checkout, which a bareactions/checkout@v7did not have.fern/.gitignore— ignoresversions/*-content/.publish-fern-docs.yml—add-pathstightened to:(glob)fern/versions/v*.yml.paths:filters, so editing it re-runs the CI that depends on it.The gitignore and the
:(glob)pathspec each independently prevent the leak; both are here because the gitignore states the intent (these are artifacts) while the pathspec keeps the bot'sadd-pathshonest if the ignore is ever relaxed.Note on step ordering
Hydration sits after
Check MDX safety, not before. That grep scans livedocs/only. Frozen content comes from released tags and cannot be edited, so a hit inside it would fail the job with no source left to fix. The step has a comment saying so.The same caveat applies more weakly to
fern check/md check/broken-links, which now do see frozen content — unavoidable, since validating the manifest is the point. Not a practical risk today (one registered version, cut from a tree that passed CI as livedocs/), but worth knowing beforeMAX_VERSIONSworth of tags accumulate. Flagged in #563.Verification
Run locally against the real
chart/v0.19.0tag:fern/versions/present (today'smain): clean no-op, exit 0.v0.19.0.ymlregistered: extracted 31.mdfiles, including the exact path CI died on,fern/versions/v0.19.0-content/getting-started/overview.md.shellcheck scripts/hydrate-fern-versions.sh— clean.make license-header-check— passes with the new script tracked.fern-docs-ci.ymlis MDX safety → hydrate → check → md check → broken-links.Not run locally:
fern checkitself (no Fern CLI here) — CI on this PR exercises it, though on amainwith no registered versions, so it proves the no-op path. The populated path is proven by the extraction test above and by re-running the publish once this lands.Conventions
./scripts/*.shfrom a workflow matchesscripts/latest-distroless.shinagent-ci.yaml/operator-ci.yaml, including listing the script inpaths:. No new pattern introduced.docs/update: no page underdocs/mentions Fern — the setup is documented entirely in the workflow header comments, which stay accurate.RELEASE_NOTES.mdentry: CI-only fix, nothing for a user to do or notice.Follow-up, not in this PR
#561 still carries the stray
index.yml. Once this merges, close it and re-run the publish — it regenerates the registration PR cleanly against the fixedadd-paths.