Skip to content
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

Change gh-rez URL based on source of build #1690

Closed
JeanChristopheMorinPerso opened this issue Mar 18, 2024 · 0 comments · Fixed by #1707
Closed

Change gh-rez URL based on source of build #1690

JeanChristopheMorinPerso opened this issue Mar 18, 2024 · 0 comments · Fixed by #1707
Labels

Comments

@JeanChristopheMorinPerso
Copy link
Member

Our Sphinx docs are setup in a way that allows us to use :gh-rez:path/to.file` to link to a file in the repo.

'gh-rez': ('https://github.com/AcademySoftwareFoundation/rez/blob/master/%s', '%s'),

This is great, but the URL is hardcoded to one branch. We should make it flexible and instead use a logic like:

blob_ref = "main"
if os.environ.get("READTHEDOCS"):
    if os.environ["READTHEDOCS_VERSION_TYPE"] == "external":
        blob_ref = os.environ["READTHEDOCS_GIT_COMMIT_HASH"]
    else:
        blob_ref = os.environ["READTHEDOCS_GIT_IDENTIFIER"]

gh_rez_url = f"https://github.com/AcademySoftwareFoundation/rez/blob/{blob_ref}/%s"

extlinks = {
    'gh-rez': (gh_rez_url, '%s'),
}

See https://docs.readthedocs.io/en/stable/reference/environment-variables.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant