如何通过GitHub API在Git标签中获取所有提交

How to get all commits in a Git tag through GitHub API

我必须获取在Git存储库上创建新标签时作为一部分的所有新提交。 这需要通过GitHub API完成。

例如,Git UI指示Tagging Tag1并具有与其关联的sha ...假设sha为:SHA1

现在如何通过GitHub API获取所有已发生或属于Tag1的提交? 我想存储所有这些提交并对它们进行一些分析。


根据您的评论的澄清:

I want to get all commits between this newly created tag and previous tag

1.获取给定存储库中的所有标签,以便获取当前和以前的标签名称

1
2
curl -X"GET""https://api.github.com/repos/:owner/:repo/tags" \\
     -H"Authorization: token YOUR_GITHUB_ACCESS_TOKEN"

tags

2.获取最近两个标签之间的所有提交

1
2
curl -X"GET""https://api.github.com/repos/:owner/:repo/compare/:tag_1...:tag_2" \\
     -H"Authorization: token YOUR_GITHUB_ACCESS_TOKEN"

enter image description here

文件连结:

  • https://developer.github.com/v3/repos/#list-tags
  • https://developer.github.com/v3/repos/commits/#compare-two-commits