Skip to content

Docs: Fix build preview banner - #104082

Closed
hugovk wants to merge 1 commit into
python:mainfrom
hugovk:docs-banner
Closed

Docs: Fix build preview banner#104082
hugovk wants to merge 1 commit into
python:mainfrom
hugovk:docs-banner

Conversation

@hugovk

Copy link
Copy Markdown
Member

There should be a banner at the top of PR build previews for docs. Here's it working on this branch as a PR on my fork:

image

But for some reason it's missing for this upstream:

TODO

The code to control this:

cpython/Doc/conf.py

Lines 117 to 124 in f0ad456

# Deployment preview information
# (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
repository_url=os.getenv("READTHEDOCS_GIT_CLONE_URL")
html_context= {
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") =="external",
"repository_url": repository_url.removesuffix(".git") ifrepository_urlelseNone,
"pr_id": os.getenv("READTHEDOCS_VERSION")
}

Let's start with a draft PR to debug the env vars.

@hugovk

Copy link
Copy Markdown
MemberAuthor

It's working here too:

image

https://cpython-previews--104082.org.readthedocs.build/en/104082/


Looking at another PR build that is missing the banner:

The RtD build page says:

Configure your documentation builds! Adding a .readthedocs.yaml file to your project is the recommended way to configure your documentation builds. You can declare dependencies, set up submodules, and many other great features.

And looking at the PR, it's from before the #103843 was merged that updated conf.py, so I think we're good here.

One thing to do though, is backport #103843 to at least 3.11 so we get banners on backport builds too.

@hugovk

Copy link
Copy Markdown
MemberAuthor

Backport PR: #104083

@hugovkhugovk closed this May 2, 2023
@hugovk
hugovk deleted the docs-banner branch May 24, 2023 15:48
Sign up for freeto 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.

2 participants

@hugovk@bedevere-bot