Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Fix build preview banner #104082

Closed
wants to merge 1 commit into from
Closed

Docs: Fix build preview banner #104082

wants to merge 1 commit into from

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented May 2, 2023

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") if repository_url else None,
"pr_id": os.getenv("READTHEDOCS_VERSION")
}

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

@hugovk
Copy link
Member Author

hugovk commented May 2, 2023

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
Member Author

hugovk commented May 2, 2023

Backport PR: #104083

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

2 participants