Skip to content

Set edit links dynamically for RtD preview and PR builds#3280

Open
mnocon wants to merge 1 commit into
5.0from
lychee-links-on-new-files
Open

Set edit links dynamically for RtD preview and PR builds#3280
mnocon wants to merge 1 commit into
5.0from
lychee-links-on-new-files

Conversation

@mnocon

@mnocon mnocon commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Target: 5.0, 6.0

The current link checker has a bug: for new Markdown files, it reports 404 for "View on GitHub" button:

#3279 (comment)

Errors in site/release_notes/cohesivo_v6.0_deprecations/index.html

    [404] https://github.com/ibexa/documentation-developer/blob/5.0/docs/release_notes/cohesivo_v6.0_deprecations.md (at 194:10) | Rejected status code: 404 Not Found

This is because the 5.0 branch is hardcoded as "edit_uri", and it looks into the 5.0 branch for changes that were not merged yet.

This PR sets the value dynamically, so for it will work correctly for PRs and for ReadTheDocs preview builds.

Doc:

The [slug](https://docs.readthedocs.com/platform/stable/glossary.html#term-slug) of the version being built, such as latest, stable, or a branch name like feature-1234. For [pull request builds](https://docs.readthedocs.com/platform/stable/pull-requests.html), the value will be the pull request number.

(from https://docs.readthedocs.com/platform/stable/reference/environment-variables.html )

So for RTD previews, commit hash is used.

Tested locally by setting the variable before building and checking the output in the site dir:

export READTHEDOCS_VERSION_NAME=marek
~/python/bin/python3.13 -m mkdocs build --strict
cat site/index.html| grep marek
<a href="https://github.com/ibexa/documentation-developer/blob/marek/docs/index.md" title="source.link.title" class="source-github">

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Preview of modified files: no change to preview.

@mnocon mnocon force-pushed the lychee-links-on-new-files branch from bfccad4 to 0496399 Compare July 7, 2026 11:04
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Status Count
🔍 Total 758288
🔗 Unique 14992
✅ Successful 7260
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 751028
❓ Unknown 0
🚫 Errors 0
⛔ Unsupported 0

Full Github Actions output

@mnocon mnocon force-pushed the lychee-links-on-new-files branch from 0496399 to b14948b Compare July 7, 2026 12:56
@mnocon mnocon marked this pull request as ready for review July 7, 2026 13:03
@mnocon mnocon requested a review from a team July 7, 2026 13:04
@ibexa-workflow-automation-1 ibexa-workflow-automation-1 Bot requested review from adriendupuis, dabrt and julitafalcondusza and removed request for a team July 7, 2026 13:05
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.

1 participant