Skip to content

Commit

Permalink
hotfix: fix tags readthedocs build
Browse files Browse the repository at this point in the history
  • Loading branch information
LancelotMarti committed Sep 5, 2024
1 parent 1917544 commit d875259
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import os
import subprocess
import yaml

import re

def git_ref_exists(git_ref: str) -> bool:
"""
Expand All @@ -26,8 +26,14 @@ def git_ref_exists(git_ref: str) -> bool:
Returns:
bool: True if the reference is found, False otherwise.
"""
#check if reference is a tag
tag_pattern = r"^v\d+\.\d+\.\d+$"
if re.match(tag_pattern, git_ref):
refs = "tags"
else:
refs = "heads"
try:
result = subprocess.run(f"git ls-remote --heads origin {git_ref}",
result = subprocess.run(f"git ls-remote --{refs} origin {git_ref}",
shell=True, text=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
Expand Down

0 comments on commit d875259

Please sign in to comment.