docs(site): make version injection generic (versions.json-driven) - #22067
Merged
Conversation
Forward-port of the generic version-injection introduced on release/3.5 (#22062). Replaces the hardcoded per-series resolver (v33Version) with a single loop over versions.json: the config fetches the latest patch release for each archived version and passes a {id -> versionString} map to the remark plugin, which routes by the `version-vX.Y` path segment. Net effect: adding a new archived version (via `docusaurus docs:version`) needs NO edits to docusaurus.config.ts or version-replace.js. This belongs on main so every release branch cut from main inherits it (pairs with the Docs Version Bump workflow, #22066). Behaviour is unchanged here: versions.json is still ["v3.3"], current label still v3.4. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR forward-ports the docs-site “generic version injection” mechanism to main, so archived docs versions (from versions.json) automatically receive the correct {ERIGON_VERSION} replacement without adding per-series configuration.
Changes:
- Replaces the hardcoded archived-series resolver with a generic
fetchLatestSeriesVersion(prefix)approach driven byversions.json. - Updates the remark plugin to detect archived versions via the
version-vX.Ypath segment and select the corresponding injected version string. - Passes a
{ archivedVersionId -> latestPatchString }map (versionStrings) into the remark plugin fromdocusaurus.config.ts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/site/src/remark/version-replace.js | Switches archive detection from a hardcoded version-v3.3 check to generic version-* segment routing via versionStrings. |
| docs/site/docusaurus.config.ts | Derives archived version injection values from versions.json and passes them into the remark plugin. |
Comments suppressed due to low confidence (1)
docs/site/docusaurus.config.ts:36
fetchLatestSeriesVersion()fetches the full releases list for each archived version, which scales linearly with the number of archives and increases the chance of GitHub API rate-limiting during docs builds. It also limits the search toper_page=50, which can fail to find older series if they fall outside the first page. Consider fetching releases once (withper_page=100) and deriving all archived series versions from that single response.
async function fetchLatestSeriesVersion(prefix: string): Promise<string> {
try {
const res = await fetch(
'https://api.github.com/repos/erigontech/erigon/releases?per_page=50',
{headers: githubHeaders()},
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
yperbasis
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Forward-ports the generic version-injection refactor (introduced on
release/3.5in #22062) tomain, so every release branch cut from main inherits it.Why on main
Release branches are cut from
main. If this infra only lived onrelease/3.5,release/3.6would revert to the old hardcoded per-series resolver. Pairs with the Docs Version Bump workflow (#22066), which also lives on main.What changes
fetchLatestV33Version/v33Versionwith a parametrizedfetchLatestSeriesVersion(prefix)looped overversions.json, building a{id -> latest patch}map.version-vX.Ypath segment instead of a hardcodedversion-v3.3check.docusaurus docs:version) needs zero edits todocusaurus.config.tsorversion-replace.js.No behavior change here
versions.jsonis still["v3.3"]and the current label is stillv3.4— verified the build injects3.3.1into the v3.3 archive and the latest release into current, exactly as before. This PR is purely the mechanism.🤖 Generated with Claude Code