Look through lightweight tags pointing to annotated tags. #212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Git has two kinds of tags, simple lightweight ones (pointing to a commit):
And annotated ones, which are represented by a lightweight tag that points at the annotated tag object:
This is confusing, as the SHA returned here cannot be treated as a commit SHA. Furthermore, it's impossible right now to look up the underlying annotated tag, as the request needs to go to
repo/git/tags
and notrepo/git/refs/tags
(so we can't just callGitHub.tag
a second time).Instead, I'm opting here to have the
tag
andtags
function automatically peek through lightweight tags that point to an annotated tags, thus always returning an object which should contain a commit object (which is probably what you want anyway):If for some reason you really need the SHA of the annotated tag, it's still there in the
tag.sha
object (note how that SHA is different from thetag.object["sha"]
).