Skip to content

Commit 63f8178

Browse files
authored
Use RTD environment variables instead of html_context (#10)
Fixes #8
1 parent d99fe3b commit 63f8178

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sphinxext/delta.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ def on_rtd() -> bool:
3636
return os.getenv("READTHEDOCS") == "True"
3737

3838

39-
def on_pr(html_context: Dict[str, str]) -> bool:
39+
def on_pr() -> bool:
4040
return (
41-
html_context["github_version"].startswith(html_context["commit"])
41+
os.getenv("READTHEDOCS_VERSION_TYPE") == "external"
4242
or os.getenv("GITHUB_EVENT_NAME") == "pull_request"
4343
)
4444

@@ -47,7 +47,7 @@ def inject_changed_files(html_context: Dict[str, str], app: Sphinx) -> None:
4747
import requests
4848

4949
res = requests.get(
50-
f"https://api.github.com/repos/{html_context['github_user']}/{html_context['github_repo']}/pulls/{html_context['current_version']}/files"
50+
f"https://api.github.com/repos/{html_context['github_user']}/{html_context['github_repo']}/pulls/{os.environ.get('READTHEDOCS_VERSION_NAME')}/files"
5151
)
5252

5353
if res.status_code != requests.codes.ok:

0 commit comments

Comments
 (0)