【问题标题】:Read all commits for a project using the GitHub API使用 GitHub API 读取项目的所有提交
【发布时间】:2015-06-14 22:01:59
【问题描述】:

我正在尝试使用 GitHub API 下载项目的所有提交。我目前正在尝试通过分支和拉取请求获取所有提交:

  • 我读取了提交 API 方法返回的所有提交(例如,api.github.com/repos/mojombo/grit/commits)。我考虑了分页。

  • 对于 API 返回的每个分支(例如,api.github.com/repos/mojombo/grit/branches),我阅读了所有提交(例如,api.github.com/repos/mojombo/grit /commits?sha=5608567286e64a1c55c5e7fcd415364e04f8986e)。

  • 对于 API 返回的每个拉取请求(例如,api.github.com/repos/mojombo/grit/pulls?state=all),我还阅读了所有提交(例如,api.github.com /repos/mojombo/grit/pulls/186/commits)。

但是,当我结合通过这些方法检索到的提交时,仍然有一些提交丢失。例如,这个https://api.github.com/repos/mojombo/grit/commits/429c045f8313c7734bbb7ae8762edb61f9edcc9a 似乎没有与任何分支或拉取请求相关联。如何确保获得与项目相关的所有次提交?

【问题讨论】:

    标签: api github commit github-api


    【解决方案1】:

    我猜你可以通过这个文档提到的方法获得所有提交:

    https://developer.github.com/v3/repos/commits/

    如果您尝试检索大量提交,可以检查 sinceuntil 参数

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-19
      • 2023-03-03
      • 1970-01-01
      • 2018-02-28
      • 2015-01-31
      • 2012-12-23
      • 1970-01-01
      • 2019-02-01
      相关资源
      最近更新 更多