Skip to content

Commit

Permalink
Add project: check YAML file for specific branch (#11607)
Browse files Browse the repository at this point in the history
Closes #11579
  • Loading branch information
humitos authored Sep 23, 2024
1 parent 03377d4 commit 31e8371
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion readthedocs/projects/views/private.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ def process_step(self, form):
# pylint: disable=too-many-nested-blocks
if isinstance(form, ProjectBasicsForm):
remote_repository = form.cleaned_data.get("remote_repository")
default_branch = form.cleaned_data.get("default_branch")
if remote_repository and remote_repository.vcs_provider == GITHUB:
remote_repository_relations = (
remote_repository.remote_repository_relations.filter(
Expand All @@ -377,8 +378,11 @@ def process_step(self, form):
"readthedocs.yml",
]:
try:
querystrings = (
f"?ref={default_branch}" if default_branch else ""
)
response = session.head(
f"https://api.github.com/repos/{remote_repository.full_name}/contents/{yaml}",
f"https://api.github.com/repos/{remote_repository.full_name}/contents/{yaml}{querystrings}",
timeout=1,
)
if response.ok:
Expand Down

0 comments on commit 31e8371

Please sign in to comment.