根据 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
.
如果您阅读了
head
和 before
来自事件负载的标识符,然后您可以 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/