Skip to content
Snippets Groups Projects
Verified Commit 77d7a671 authored by Duncan Macleod's avatar Duncan Macleod
Browse files

docs: improve linkcode git ref handling

parent 0c403921
No related branches found
No related tags found
No related merge requests found
......@@ -93,6 +93,12 @@ napoleon_use_rtype = False
def _project_git_ref(version, prefix="v"):
"""Returns the git reference for the given full release version.
"""
# handle builds in CI
if os.getenv("GITLAB_CI"):
return os.environ["CI_COMMIT_REF"]
if os.getenv("GITHUB_ACTIONS"):
return os.environ["GITHUB_SHA"]
# otherwise use the project metadata
_setuptools_scm_version_regex = re.compile(
r"\+g(\w+)(?:\Z|\.)",
)
......@@ -107,7 +113,7 @@ PROJECT_URL = getenv(
"CI_PROJECT_URL",
"https://git.ligo.org/computing/gwdatafind/client",
)
PROJECT_BLOB_URL = f"{PROJECT_URL}/-/blob/{PROJECT_GIT_REF}/{PROJECT_PATH.name}"
PROJECT_BLOB_URL = f"{PROJECT_URL}/blob/{PROJECT_GIT_REF}/{PROJECT_PATH.name}"
def linkcode_resolve(domain, info):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment