Skip to content

feat: show version in docs navbar#27

Merged
23prime merged 3 commits intomainfrom
feature/docs-version-in-navbar
Mar 10, 2026
Merged

feat: show version in docs navbar#27
23prime merged 3 commits intomainfrom
feature/docs-version-in-navbar

Conversation

@23prime
Copy link
Owner

@23prime 23prime commented Mar 10, 2026

Checklist

  • Target branch is main
  • Status checks are passing

Summary

  • Pass DOCS_VERSION env var (= git tag name) to the Docusaurus build step in docs.yml
  • Read process.env.DOCS_VERSION in docusaurus.config.js and display it as an HTML navbar item (falls back to dev when not set)

Reason for change

Users visiting the docs site had no way to know which version the docs correspond to.

Changes

  • .github/workflows/docs.yml: add env.DOCS_VERSION: ${{ github.ref_name }} to the build step
  • website/docusaurus.config.js: add version constant and a type: 'html' navbar item showing it

Notes

  • workflow_dispatch runs (manual trigger without a tag) will show dev as the version label.

Copilot AI review requested due to automatic review settings March 10, 2026 04:01
@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5611aae-d5fa-4469-902f-aa40ebfe524f

📥 Commits

Reviewing files that changed from the base of the PR and between 47c977f and 4fff8d7.

📒 Files selected for processing (2)
  • .github/workflows/docs.yml
  • website/docusaurus.config.js

📝 Walkthrough

Walkthrough

The pull request adds documentation versioning support by introducing a DOCS_VERSION environment variable in the CI workflow that captures git tag information, and configures Docusaurus to display this version in the navbar with HTML-escaped rendering.

Changes

Cohort / File(s) Summary
Workflow Configuration
.github/workflows/docs.yml
Added DOCS_VERSION environment variable to the Build step, conditionally set to git tag name when building from tag push events, otherwise empty string.
Docusaurus Configuration
website/docusaurus.config.js
Introduced version constant sourced from DOCS_VERSION env var (defaults to 'dev'), added escapeHtml() utility function for sanitization, and injected a navbar item to display the escaped version string on the right side.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A version hops into the navbar bright,
Tagged with care, and escaped just right,
From workflows deep to docs so fine,
The version string now has a place to shine!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: show version in docs navbar' clearly and concisely summarizes the main feature being added—displaying the version in the documentation navbar.
Description check ✅ Passed The description is directly related to the changeset, providing clear context about passing DOCS_VERSION to the build step and displaying it in the navbar with appropriate fallback behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/docs-version-in-navbar
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature/docs-version-in-navbar

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a build-time docs version label so users can see which tagged release the published Docusaurus site corresponds to.

Changes:

  • Passes DOCS_VERSION (from github.ref_name) into the docs build step in the GitHub Pages workflow.
  • Reads process.env.DOCS_VERSION in Docusaurus config and displays it in the navbar (fallback dev).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/docs.yml Exposes the git ref/tag name to the docs build via DOCS_VERSION.
website/docusaurus.config.js Adds a navbar item that renders the version string from DOCS_VERSION (or dev).

23prime added 2 commits March 10, 2026 13:04
Addresses review comment: on workflow_dispatch runs github.ref_name is the branch name not a tag
Addresses review comment: version string interpolated into HTML should be escaped
@23prime 23prime merged commit 3b856f9 into main Mar 10, 2026
7 checks passed
@23prime 23prime deleted the feature/docs-version-in-navbar branch March 10, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants