【发布时间】:2017-11-27 10:27:22
【问题描述】:
我想在 github REST api 中获取单独文件的所有提交消息。但我得到的只是为了获得单独分支的所有提交。然后我试图得到以下信息:
http://api.github.com/users/<username>/<project>/commits/<branch>/<path/to/file>
但这也无济于事。这至少可能吗?
【问题讨论】:
标签: github github-api
我想在 github REST api 中获取单独文件的所有提交消息。但我得到的只是为了获得单独分支的所有提交。然后我试图得到以下信息:
http://api.github.com/users/<username>/<project>/commits/<branch>/<path/to/file>
但这也无济于事。这至少可能吗?
【问题讨论】:
标签: github github-api
【讨论】:
https://api.github.com/repos/{owner}/{repo}/commits?sha={branch}&path={path}
使用GraphQL API v4,对于默认分支上的文件,它将是:
{
repository(owner: "izuzak", name: "pmrpc") {
defaultBranchRef{
target {
...on Commit{
history(first:100,path: "README.markdown"){
nodes {
author {
email
}
message
oid
}
}
}
}
}
}
}
【讨论】: