feat(ci): automate Fern version registration and harden publish workflow#1290
Conversation
On docs/vX.Y.Z tag push, the publish workflow now: 1. Generates fern/versions/vX.Y.Z.yml from the tag's docs/index.yml 2. Adds a version entry to fern/docs.yml via yq 3. Commits both back to main for future publishes Also hardens frozen version checkout (guard, warning not error, MDX img self-closing fix) and switches version stamping from sed to yq. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
📝 WalkthroughWalkthroughThe PR automates Fern version artifact generation on ChangesFern Version Automation and Frozen Version Hardening
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
🧹 Nitpick comments (1)
.github/workflows/publish-fern-docs.yml (1)
93-93: 💤 Low valueMinor inconsistency with preview workflow's tag verification.
This step uses bare ref resolution (
git rev-parse "$version"), while the preview workflow at line 69 uses explicit tag verification (git rev-parse -q --verify "refs/tags/$version"). Both work in practice since version names likev1.5.0are typically only tags, but the explicit form is more precise and guards against accidentally matching a branch with the same name.Consider aligning with the preview workflow for consistency:
🔧 Suggested change
- if git rev-parse "$version" >/dev/null 2>&1; then + if git rev-parse -q --verify "refs/tags/$version" >/dev/null 2>&1; then🤖 Prompt for 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. In @.github/workflows/publish-fern-docs.yml at line 93, The tag-existence check currently uses a bare ref resolution (git rev-parse "$version"); update the check to the explicit tag verification used in the preview workflow by using git rev-parse -q --verify "refs/tags/$version" so it only matches tags (not branches) when evaluating the variable version; replace the condition around the git rev-parse call accordingly where the step performs the tag verification.
🤖 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.
Nitpick comments:
In @.github/workflows/publish-fern-docs.yml:
- Line 93: The tag-existence check currently uses a bare ref resolution (git
rev-parse "$version"); update the check to the explicit tag verification used in
the preview workflow by using git rev-parse -q --verify "refs/tags/$version" so
it only matches tags (not branches) when evaluating the variable version;
replace the condition around the git rev-parse call accordingly where the step
performs the tag verification.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: a555ee22-c782-478c-ab4c-fd3a2ad5edd8
📒 Files selected for processing (2)
.github/workflows/fern-docs-preview-build.yml.github/workflows/publish-fern-docs.yml
…heckout Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/publish-fern-docs.yml (1)
73-85: 💤 Low valueConsider adding a pull/rebase before push for robustness.
The push on line 85 could fail if
mainmoves between checkout and push (e.g., external commits). While the concurrency control helps prevent races within this workflow, external pushes to main could still cause failures.This is acceptable for infrequent tag-push automation since failed runs can be retried, but adding a pull before push would improve resilience.
♻️ Optional: pull before push
git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add fern/versions/ fern/docs.yml git commit -m "chore(fern): add ${TAG_VERSION} version entry [automated]" + git pull --rebase origin main git push origin main🤖 Prompt for 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. In @.github/workflows/publish-fern-docs.yml around lines 73 - 85, The commit-and-push step that runs TAG_VERSION and executes git push origin main can fail if origin/main changed after checkout; update the block that configures git user and runs git add/commit (the step named "Commit new version entry") to fetch and rebase the latest main before pushing (e.g., run git fetch origin && git rebase origin/main or git pull --rebase origin main), handle non-zero exit (abort/exit with message) if rebase fails, and only run git push origin main after a successful fast-forward/rebase to avoid push conflicts.
🤖 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.
Nitpick comments:
In @.github/workflows/publish-fern-docs.yml:
- Around line 73-85: The commit-and-push step that runs TAG_VERSION and executes
git push origin main can fail if origin/main changed after checkout; update the
block that configures git user and runs git add/commit (the step named "Commit
new version entry") to fetch and rebase the latest main before pushing (e.g.,
run git fetch origin && git rebase origin/main or git pull --rebase origin
main), handle non-zero exit (abort/exit with message) if rebase fails, and only
run git push origin main after a successful fast-forward/rebase to avoid push
conflicts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 092d7c04-419c-4df9-8e61-e67c823fd224
📒 Files selected for processing (1)
.github/workflows/publish-fern-docs.yml
Summary
Automate Fern version registration on
docs/vX.Y.Ztag push and harden the publish workflow. Pattern ported from NVIDIA/topograph (PRs #325, #327, #329, #330).On tag push the workflow now:
fern/versions/vX.Y.Z.ymlfrom the tag'sdocs/index.ymlfern/docs.ymlviayqAlso:
sedtoyqcontents: writefor the commit-back stepFixes #1289
Type of Change
Component(s) Affected
Testing
Checklist
Summary by CodeRabbit