feat(ci): trigger publish on release tags, auto-register and prune versions#1292
Conversation
📝 WalkthroughWalkthroughThe workflow is updated to trigger on semver release tags (v1.2.3) instead of manual docs tags, and automatically manages Fern documentation versions by generating version files, updating the docs index, pruning older entries beyond a configured limit, and committing changes back to the repository. ChangesFern Documentation Release-Based Versioning
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 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 |
…rsions Switch publish trigger from docs/v* to release tags (v[0-9]*.[0-9]*.[0-9]*). On release tag push, auto-register the version in the Fern dropdown and prune to keep Latest + 3 most recent. Pre-release tags (containing '-') still trigger publish but skip version registration and pruning. Also hardens frozen checkout (glob guard, warning not error, MDX img fix) and switches version stamping from sed to yq. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The merge-base changed after approval.
0e5632c to
d75b279
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/publish-fern-docs.yml (1)
40-45:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftPublish from the tag, not from
main.Line 44 makes a tag-triggered run build from
main, so avX.Y.Zpublish can drift from the tagged snapshot ifmainhas moved by the time the job starts. It also leaves the later metadata push racing any new commits that land onmainduring the run. Use one checkout at${{ github.ref }}for publishing/frozen-content extraction and a separate fresh checkout ofmainfor the registration commit.Also applies to: 95-107
🤖 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 40 - 45, The workflow currently checks out main for a tag-triggered run (the actions/checkout step using ref: main), which can cause the published artifacts to drift; change that checkout to use the triggering ref (use ref: ${{ github.ref }} or equivalent) so the publish builds from the tagged snapshot, and add a second, separate checkout step that explicitly checks out main (fresh actions/checkout@...) to perform the registration/metadata commit; update references in the later registration/push steps to use that second checkout workspace so publication is frozen to the tag while registration uses the latest main.
🤖 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.
Outside diff comments:
In @.github/workflows/publish-fern-docs.yml:
- Around line 40-45: The workflow currently checks out main for a tag-triggered
run (the actions/checkout step using ref: main), which can cause the published
artifacts to drift; change that checkout to use the triggering ref (use ref: ${{
github.ref }} or equivalent) so the publish builds from the tagged snapshot, and
add a second, separate checkout step that explicitly checks out main (fresh
actions/checkout@...) to perform the registration/metadata commit; update
references in the later registration/push steps to use that second checkout
workspace so publication is frozen to the tag while registration uses the latest
main.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ef210535-02aa-462b-bb51-95a64a44c223
📒 Files selected for processing (2)
.github/workflows/fern-docs-preview-build.yml.github/workflows/publish-fern-docs.yml
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/publish-fern-docs.yml (1)
84-84: 💤 Low valueConsider using standard yq syntax for the slug extraction.
The
.products[0].versions[$KEEP:].[].slugsyntax works but the leading.before[]is unusual. The more conventional form would be.products[0].versions[$KEEP:][].slug.♻️ Optional: use conventional yq iterator syntax
- PRUNED=$(yq ".products[0].versions[$KEEP:].[].slug" fern/docs.yml) + PRUNED=$(yq ".products[0].versions[$KEEP:][].slug" fern/docs.yml)🤖 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 84, The yq query in the PRUNED assignment uses an unusual leading dot before the iterator (.products[0].versions[$KEEP:].[].slug); update the query used by the PRUNED=$(yq "...") command to the conventional iterator form .products[0].versions[$KEEP:][].slug so the slug extraction uses standard yq syntax (replace the ".[] " segment with "[]").
🤖 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 84: The yq query in the PRUNED assignment uses an unusual leading dot
before the iterator (.products[0].versions[$KEEP:].[].slug); update the query
used by the PRUNED=$(yq "...") command to the conventional iterator form
.products[0].versions[$KEEP:][].slug so the slug extraction uses standard yq
syntax (replace the ".[] " segment with "[]").
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 88be6808-0748-4cae-820a-49cc5dc4a950
📒 Files selected for processing (1)
.github/workflows/publish-fern-docs.yml
|
Re: CodeRabbit's note about checking out The frozen version checkout step already extracts docs content via The Leaving as-is. |
Summary
Switch Fern publish from
docs/v*tags to release tags. On release tag push, auto-register the version in the Fern dropdown and prune to keep Latest + 3 most recent. Pre-release tags (containing-) still trigger publish but skip registration and pruning.Also hardens frozen checkout (glob guard, warning not error, MDX img self-closing fix) and switches version stamping from
sedtoyq.Fixes #1291
Supersedes #1290
Type of Change
Component(s) Affected
Testing
Checklist
Summary by CodeRabbit