Skip to content

fix: use GITHUB_BASE_REF to detect stable branch for display_version and PDF - #15158

Merged
skjnldsv merged 4 commits into
masterfrom
fix/display-version-stable-branches
Jun 16, 2026
Merged

fix: use GITHUB_BASE_REF to detect stable branch for display_version and PDF#15158
skjnldsv merged 4 commits into
masterfrom
fix/display-version-stable-branches

Conversation

@skjnldsv

Copy link
Copy Markdown
Member

Follow-up to #15140, discovered while fixing backport PRs #15154 #15155 #15156.

The previous display_version detection used GITHUB_REF matched against refs/heads/stable(\d+)$. This breaks for backport branches (backport/15140/stable33) where GITHUB_REF is 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 clean stableNN) for PRs, falling back to GITHUB_REF for 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 version step — uses GITHUB_BASE_REF fallback so backport PR CI shows the correct version on the PDF cover.

Master behavior is unchanged: GITHUB_BASE_REF is empty for direct master pushes, GITHUB_REF = refs/heads/master does not match ^stable, so display_version = str(version_stable + 1) = '35' as before.

✅ Checklist

  • I have built the documentation locally and reviewed the output
  • Screenshots are included for visual changes
  • I have not moved or renamed pages (or added a redirect if I did)
  • I have run codespell or similar and addressed any spelling issues

…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>
@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label Jun 16, 2026
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv skjnldsv self-assigned this Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

🔍 Open preview →

No RST documentation pages changed in this PR.

Last updated: Tue, 16 Jun 2026 08:10:34 GMT

skjnldsv added 2 commits June 16, 2026 09:53
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>
@skjnldsv
skjnldsv marked this pull request as ready for review June 16, 2026 09:38
@skjnldsv
skjnldsv merged commit c10bd0c into master Jun 16, 2026
26 checks passed
@skjnldsv
skjnldsv deleted the fix/display-version-stable-branches branch June 16, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review bug github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant