【发布时间】:2016-07-11 03:27:07
【问题描述】:
我正在尝试识别包含特定提交的所有标签。使用 git 命令工具,可以通过以下方式完成:
git tag --contains <commit>
但是,我需要为多个存储库执行此操作,因此我期望依赖 REST API。有没有办法通过 GitHub 的 REST API 收集相同的信息?
【问题讨论】:
标签: github github-api
我正在尝试识别包含特定提交的所有标签。使用 git 命令工具,可以通过以下方式完成:
git tag --contains <commit>
但是,我需要为多个存储库执行此操作,因此我期望依赖 REST API。有没有办法通过 GitHub 的 REST API 收集相同的信息?
【问题讨论】:
标签: github github-api
我在一个相关问题上找到了this answer,以提供我需要的东西。
您将首先 get a list of tags 为您的回购:
https://api.github.com/repos/:user/:repo/tags
然后,对于每个标签,您将compare the branch with the SHA:
https://api.github.com/repos/:user/:repo/compare/:tagName...:sha_of_commit
如果响应中status属性的值为diverged或ahead,则该提交不包含在标签中。如果status 属性的值为behind 或identical,则提交包含在标记中。
【讨论】: