-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Expose another environment variable for PR builds #8461
Comments
I'm 👍🏼 on this. However, the name of the variable may be something like |
This is implemented in #8237, but using |
I think we can port the changes that add the new env vars (https://github.com/readthedocs/readthedocs.org/pull/8237/files#diff-99dfd740f4f146e66e1c3709bebdc3db357a8c6defbf3e592434be4308f5d697), and leave out the other change about improving the name shown for external builds. |
@stsewd Anything I can help with to get this merged? |
Having a way (probably environment variable) to get if the build is for a PR or not would be useful (or type of RTD build), along with branch information:
|
As a solution in the meantime, https://github.com/wpilibsuite/sphinxext-delta/ detects and only runs on PR builds on RTD (if your source code is on GitHub). The PR detection is at https://github.com/wpilibsuite/sphinxext-delta/blob/1ce65493eb26db0e8d9575b7b3ddc1737963077a/sphinxext/delta.py#L39-L43. def on_pr(html_context: Dict[str, str]) -> bool:
return (
html_context["github_version"].startswith(html_context["commit"])
or os.getenv("GITHUB_EVENT_NAME") == "pull_request"
) We use it in combination with RTD detection at https://github.com/wpilibsuite/sphinxext-delta/blob/1ce65493eb26db0e8d9575b7b3ddc1737963077a/sphinxext/delta.py#L97. |
Hi @TheTripleV, thanks for sharing your solution! I'm curious, how did you realize that the |
To be honest, that might be something that Github Actions sets. |
With #8237 merged, one now can do |
RTD already exposes the
READTHEDOCS
environment variable to provide the option for changed behavior if it is building the docs.It would be nice to have an additional environment variable, e.g.
READTHEDOCS_PR
, that will only be set if the current build was initiated from a PR.The text was updated successfully, but these errors were encountered: