Github API - Get Branch of Tag

荒凉一梦 提交于 2019-12-11 02:29:46

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/14062533/github-api-get-branch-of-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!