-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Build: READTHEDOCS_GIT_IDENTIFIER
shouldn't be the commit SHA on versions from tags
#11662
Comments
What's the URL of your project? What's the URL of the build where you're noticing this? |
Added. I pasted the URLs into the template wrong I guess |
Where I should check the content of this variable in your documentation? I'm not able to find the the SHA in the page you linked. |
the example line of It should say |
I'm not able to reproduce this issue. I did a try at https://test-builds.readthedocs.io/en/full-feature/environment-variables.html and you can see there that |
I think that variable is never the tag name. It seems that it can only be a branch name and or a commit sha when it's a tag. Using my previous branch, I created a tag named Taking a look at the same page, https://test-builds.readthedocs.io/en/v0.1-full-feature/environment-variables.html, we can see that both environment variables have the same value and it's a commit sha. We use readthedocs.org/readthedocs/builds/models.py Lines 107 to 114 in 173d044
I found that calling
This is a bug and we should fix it. |
READTHEDOCS_GIT_IDENTIFIER
shouldn't be the commit SHA on versions from tags
I'm adding this issue to the roadmap. We have another user hitting this bug. |
So, looks like we aren't saving the branch/tag name that was used in a build, we merely rely on the commit. We can infer the branch/tag name from the version, but that doesn't work for the stable version (we don't save the tag name for stable #10935), and for build from PRs (builds only know the PR number, not the branch). Are we okay with a solution that doesn't work for those two cases? |
I understand if we don't have the branch/tag name we will have the commit, right? We can use |
That will work for the case of stable I guess, but it won't work for PR builds, as we fetch it as |
For PR we will have a commit hash as well. That's what we need to return here and it will be consistent. |
Do you mean return the commit itself? That doesn't seem consistent, as we will return the branch/tag name on all other cases. |
Meh, I'm sorry, I got confused.
👍🏼
We can return what GitHub shows for this cases: |
Hi! Just came here to say that I also have this issue. I published my documentation using tags as a way to provide permalinks, and I use However, when publishing from tags, E.g., the following page shows documentation for tag For your information, I build the link to source code with: git_ref = os.environ.get("READTHEDOCS_GIT_IDENTIFIER", "main")
def linkcode_resolve(domain: str, info: dict[str, Any]) -> str | None:
# ...
return f"https://github.com/jeertmans/DiffeRT/blob/{git_ref}/{filename}{lines}" Note that the issue also occurs on pull-request builds (but I can this is related to what you said above). Not sure if that can help you :-) |
Details
I'm using
READTHEDOCS_GIT_IDENTIFIER
in my docs to indicate the git tag to check out for a GitHub action. Unfortunately its rendering as the raw SHAExpected Result
READTHEDOCS_GIT_IDENTIFIER
is the name of the tag that was checked outthis is what the docs say it should be
Actual Result
READTHEDOCS_GIT_IDENTIFIER
is the raw commit SHAWorkaround
I guess I can do a
git describe
Front conversations
The text was updated successfully, but these errors were encountered: