【发布时间】:2018-01-16 05:35:03
【问题描述】:
我在here找到的所有现有的github API中搜索了一个源文件中某行代码的责备信息,但我找不到实现它的方法,该API未列出上述网站。谁能指出我获取源文件的一行代码的责备信息的方法,该源文件托管在 github repos 中,无需克隆它并在本地运行git blame。
提前致谢
【问题讨论】:
标签: git github-api
我在here找到的所有现有的github API中搜索了一个源文件中某行代码的责备信息,但我找不到实现它的方法,该API未列出上述网站。谁能指出我获取源文件的一行代码的责备信息的方法,该源文件托管在 github repos 中,无需克隆它并在本地运行git blame。
提前致谢
【问题讨论】:
标签: git github-api
GitHub API v4 有一个有效的责备 API。以下是正确查询的示例:
{
# repository name/owner
repository(name: "MidiPlayerJS", owner: "TimMensch") {
# branch name
ref(qualifiedName:"tim") {
target {
# cast Target to a Commit
... on Commit {
# full repo-relative path to blame file
blame(path:"package.json") {
ranges {
commit {
author {
name
}
}
startingLine
endingLine
age
}
}
}
}
}
}
}
这适用于我的explorer。
【讨论】:
GitHub REST API http://developer.github.com/v3/ 中没有 Blame API
但是您可以通过处于早期访问模式的新 GraphQL API 获取责任信息。请参阅此文档https://developer.github.com/early-access/graphql/
【讨论】: