fix(ci): populate frozen version content in preview build and surface fern errors#892
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWorkflows now extract frozen-version docs from git tags into fern/versions/-content: they iterate fern/versions/v*.yml, verify tags with git show-ref, archive the tag's docs/ and untar into per-version content directories, and post-process extracted markdown to escape braces and convert '<' to '<'. The comment workflow change enables pipefail and streams fern generate output through tee into /tmp/fern-output.log, then greps that log to extract and export the preview URL. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/fern-docs-preview-build.yml:
- Around line 62-64: The git checks should explicitly target tag refs instead of
any ref; update the snippet that uses git rev-parse "$version" and git archive
"$version" to use refs/tags/$version (e.g., git rev-parse "refs/tags/$version"
and git archive "refs/tags/$version") so the existence check and archive
operation only resolve tag refs and cannot accidentally pick up branches or
commits.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 3659a4f1-8f13-4b6f-8b6f-dac625c04b21
📒 Files selected for processing (2)
.github/workflows/fern-docs-preview-build.yml.github/workflows/fern-docs-preview-comment.yml
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/fern-docs-preview-build.yml:
- Line 65: The current sed invocation that rewrites only <img> tags (the find
... -exec sed -i 's/<img \([^>]*[^/]\)>/<img \1 \/>/g' {} + command) must be
extended to perform the same MDX-safe sanitizations used by the publish
workflow: escape or replace bare `{`, `}`, and un-closed `<` characters so they
won't be interpreted as JSX/MDX. Update the command sequence invoked by the find
-exec (or replace it with the same series of sed substitutions used in the
publish workflow) so it performs all three sanitizations (img tag self-closing
plus sanitizing `{`, `}`, and `<`) on the matched '*.md' files, ensuring parity
with publish.
In @.github/workflows/publish-fern-docs.yml:
- Around line 49-55: The workflow step enables pipefail but doesn't fail fast on
command errors; update the shell safety flags at the start of the block (replace
or augment the existing set -o pipefail) to include -e (e.g., set -e -o pipefail
or set -euo pipefail) so the git archive and tar extraction pipeline (the for
loop handling fern/versions/v*.yml, git archive "refs/tags/${version}" -- docs/
| tar -x --strip-components=1 -C "fern/versions/${version}-content") will abort
the job immediately if any command in that pipeline fails.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 917e04cf-4aed-4892-b5ee-1e221a9819d4
📒 Files selected for processing (2)
.github/workflows/fern-docs-preview-build.yml.github/workflows/publish-fern-docs.yml
Summary
Add
git archivestep to the preview build workflow to populate frozen version content, and switch the preview comment from variable capture totee-based streaming so fern errors are visible in CI logs.Motivation / Context
Fixes: #891
Related: NVIDIA/topograph#322, NVIDIA/NVSentinel#1285
Type of Change
Component(s) Affected
docs/,examples/)Implementation Notes
Preview build (
fern-docs-preview-build.yml) — added "Checkout frozen version content" step that mirrors the publish workflow'sgit archiveloop. For eachfern/versions/v*.yml, extracts docs from the corresponding git tag intofern/versions/<version>-content/. Uses::warning::(not error) for missing tags so PRs on repos that haven't cut a release yet still pass.Preview comment (
fern-docs-preview-comment.yml) — replacedOUTPUT=$(fern generate ... 2>&1) || truewithset -o pipefail+tee /tmp/fern-output.log. Errors now stream in real time and the exit code propagates correctly.Same pattern applied to NVIDIA/topograph#322 and NVIDIA/NVSentinel#1285.
Testing
CI will validate on this PR — the preview build should now include frozen version content and the preview comment should surface any fern errors.
Risk Assessment
Rollout notes: N/A
Checklist
git commit -S)