GitHub 推送事件所有提交

标签 github github-api

根据 Push Event 的 GitHub API 事件页面它返回一个数组 commits .它说如下:

The array includes a maximum of 20 commits. If necessary, you can use the Commits API to fetch additional commits.



唯一的问题是,在查看提交 API 时,无法获取链接到特定 Push Event 的提交。 .

运行 GET URL 的 HTTP 请求:https://api.github.com/repos/OWNER/REPO/commits?sha=commitsha似乎返回了之前的所有提交 sha .我只是想以某种方式获得在该特定 Push Event 中推送的提交.

我怎样才能做到这一点?

最佳答案

I'm just looking to somehow get the commits that were pushed in that specific Push Event.



如果您阅读了 headbefore来自事件负载的标识符,然后您可以 compare two commits在此范围内最多获得 250 次提交:
GET  https://api.github.com/repos/{owner|/{repo}/compare/{before}...{head}

来自该端点的 API 响应包含许多附加信息,但 commits数组就是你要找的。

关于GitHub 推送事件所有提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44177904/

相关文章:

graphql - 如何使用 Github GraphQL Api 创建问题和标签?

github - 将错误的用户名提交到github

xcode - 如何从 Xcode 8 上的先前提交中恢复?

javascript - Github 贡献图

git - Git如何向上游推送?

version-control - GitHub 多个存储库与多个环境的分支

python-2.7 - 错误:redirect_uri_mismatch::redirect_uri 必须与注册的回调 URL 匹配

github - 使用 github webhook 阅读文档结果为 400 : "Payload not valid, invalid or missing signature"

python - 如何在 boto 中设置 `aws` 的凭据?

jenkins - 无法让 Jenkins 使用构建状态更新 GitHub Pull 请求