shields icon indicating copy to clipboard operation
shields copied to clipboard

Add submodule support to GitHub tag

Open RadAd opened this issue 9 months ago • 4 comments

On GitHub the submodule is only shown as a commit id.

I would like to know the tag (if any) associated with that tag.

eg: https://img.shields.io/github/v/tag/:user:/:repo:/:submodule:

Would that be possible?

RadAd avatar May 20 '25 00:05 RadAd

I think git submodules are only associated with a commit, not a tag Tag isn't an available field https://docs.github.com/en/graphql/reference/objects#submodule

chris48s avatar May 20 '25 21:05 chris48s

Is it possible to get the tag from a commit id? Well, I guess it is possible by searching the tags in the submodule repository. Is that too much work though?

RadAd avatar May 21 '25 00:05 RadAd

I think there's a couple of problems.

Ideally we should be able to fetch the data we need to render a badge in a single API call for performance reasons (we need to be able to fetch the data and render the badge inside a request/response cycle). This would require multiple calls and worst-case could require paging over results to find a match. I don't think there is a direct API query for "get all tags for this commit hash"

The other one is that a tag is associated with exactly one commit, but a commit can be associated with many tags. Many repos use a linear tag history, but for example if you consider a repo like https://github.com/gatsbyjs/gatsby the commit e8e17e77 is tagged with

but if all you have is e8e17e77, how would you choose which one?

I think this one would be impractical, unfortunately.

chris48s avatar May 21 '25 16:05 chris48s

I also think the conversation and concerns articulated on #4934 remain relevant and would move to close this (with #9996 continuing to have some submodule related badges worth potentially considering)

calebcartwright avatar May 21 '25 18:05 calebcartwright