Skip to content

fix(ci): use yq instead of sed for version stamp in publish workflow#943

Merged
mchmarny merged 1 commit into
NVIDIA:mainfrom
pdmack:pdmack/fix-fern-stamp-yq
May 16, 2026
Merged

fix(ci): use yq instead of sed for version stamp in publish workflow#943
mchmarny merged 1 commit into
NVIDIA:mainfrom
pdmack:pdmack/fix-fern-stamp-yq

Conversation

@pdmack

@pdmack pdmack commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace fragile sed pattern with structural yq selector for the "Latest · vX.Y.Z" version stamp in the publish workflow.

Motivation / Context

Fixes: #942
Related: N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Build/CI/tooling

Component(s) Affected

  • Other: .github/workflows/publish-fern-docs.yml

Implementation Notes

The stamp step uses sed 's/display-name: "Latest"/display-name: "Latest · vX.Y.Z"/' but after yq rewrites docs.yml in earlier steps, the YAML quoting style changes and the sed pattern no longer matches. The stamp silently fails.

Replaced with the same yq approach used by topograph and NVSentinel:

yq -i '(.products[0].versions[] | select(.slug == "latest")).display-name = "Latest · " + env(VERSION)' fern/docs.yml

Also updated the diagnostic output from grep to yq for consistency.

Testing

Full publish pipeline replicated locally:

  1. Extracted frozen content for v0.12.0, v0.12.1, v0.13.0
  2. Stamped with yq — dropdown shows "Latest · v0.13.0"
  3. Published to preview — verified at nvidia-preview-debug-full-gha.docs.buildwithfern.com/aicr

Risk Assessment

  • Low — Isolated change, well-tested, easy to revert

Rollout notes: Requires a workflow_dispatch after merge to take effect on the live site.

Checklist

  • I did not skip/disable tests to make CI green
  • Changes follow existing patterns in the codebase
  • Commits are cryptographically signed (git commit -S)

@pdmack pdmack requested a review from a team as a code owner May 16, 2026 19:20
@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: fe328ea7-0b18-4eaa-ba4c-c53ca7094578

📥 Commits

Reviewing files that changed from the base of the PR and between 37b3127 and 76b8b10.

📒 Files selected for processing (1)
  • .github/workflows/publish-fern-docs.yml

📝 Walkthrough

Walkthrough

This PR updates the "Stamp version in docs.yml" step in the .github/workflows/publish-fern-docs.yml workflow to replace a sed-based approach with yq for setting the "Latest · " display name. The previous sed pattern became fragile after earlier steps reformatted the YAML file, causing the version stamp to silently fail. The new yq command selects the version entry where slug == "latest" and sets its display-name field, matching the approach used in related repositories.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • NVIDIA/aicr#936: Modifies the same publish-fern-docs workflow around version stamping logic.

Suggested labels

area/ci, size/S

Suggested reviewers

  • mchmarny
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: replacing sed with yq for version stamping in the CI workflow.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the motivation, implementation, testing, and risk assessment.
Linked Issues check ✅ Passed The PR fully addresses issue #942 by implementing the exact yq-based replacement requested and verifying it through local testing.
Out of Scope Changes check ✅ Passed All changes in the PR are scoped to the publish workflow fix; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@mchmarny mchmarny merged commit 3c2aa56 into NVIDIA:main May 16, 2026
32 checks passed
@pdmack pdmack deleted the pdmack/fix-fern-stamp-yq branch May 19, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: publish workflow version stamp silently fails due to sed fragility

2 participants