简体   繁体   中英

Github API - Get Branch of Tag

I am currently writing a system to automatically archive stable releases of a piece of sofwtare that we maintain. The source is maintained in GitHub, and I am using the v3 API to pull out each tag, check if it is present in our system, and if it is not archive it. The issue I am running into is that I would like to include additional information along with what I get back for the tag. Specifically, I would like to be able to include the branch that the commit for that tag was committed to.

Is this possible using the GitHub API? If it is, could someone please point me to the relevant documentation. If it isn't, a little information as to why would be very helpful to me.

Thanks!

No, this is not possible. As to why: the branch it was created on is not a property of a tag. In fact git has no idea about which branch a tag was created on at all. Git can guess that by starting at all branch heads and see from which of those the tag is reachable. You can do that in git by running:

git branch --contains mytag

I guess github doesn't offer an api for this operation, because it might actually take some time depending on repo size. If you want to know that, just clone the repo to your server and run the command above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM