fix: use GITHUB_BASE_REF to detect stable branch for display_version and PDF - #15158
Merged
Conversation
…and PDF The previous approach matched GITHUB_REF against a stable branch pattern. This breaks for backport/*/stableNN branches where GITHUB_REF points to the source branch, not the target. Use GITHUB_BASE_REF (the PR target, always stableNN) for PRs, falling back to GITHUB_REF for direct pushes. Both are matched strictly against ^stable([0-9]+)$ — no loose suffix matching. Also set html_context current_version to the detected stable version integer so the picker correctly highlights the current docs version instead of always showing "latest" as selected on stable branch builds and PRs. Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Contributor
📖 Documentation PreviewNo RST documentation pages changed in this PR. Last updated: Tue, 16 Jun 2026 08:10:34 GMT |
display_version reflects the current branch (e.g. '32' on stable32), which is correct for titles and the picker button but wrong for the 'latest' picker entry which should always show the master dev version. Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
… docs When building docs for a branch older than version_start (e.g. stable26), the picker now includes that version labeled "(unsupported)" at the bottom, so users can see: 35 (latest), 34 (stable), 33, 32, 26 (unsupported). Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
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.
Follow-up to #15140, discovered while fixing backport PRs #15154 #15155 #15156.
The previous
display_versiondetection usedGITHUB_REFmatched againstrefs/heads/stable(\d+)$. This breaks for backport branches (backport/15140/stable33) whereGITHUB_REFis the source branch, not the target — causing the picker button to show "latest", the picker to highlight the wrong entry, and the PDF to say "Nextcloud 35" instead of "33".Fix: use
GITHUB_BASE_REF(the PR target branch, always a cleanstableNN) for PRs, falling back toGITHUB_REFfor direct pushes. Both matched strictly against^stable([0-9]+)$— no loose pattern matching.Also:
html_context['current_version']is now set to the detected stable version integer so the picker correctly highlights the current docs version instead of always highlighting "latest".PDF: same fix in the
Compute PDF release versionstep — usesGITHUB_BASE_REFfallback so backport PR CI shows the correct version on the PDF cover.Master behavior is unchanged:
GITHUB_BASE_REFis empty for direct master pushes,GITHUB_REF = refs/heads/masterdoes not match^stable, sodisplay_version = str(version_stable + 1) = '35'as before.✅ Checklist
codespellor similar and addressed any spelling issues