[英]How do I get all public GitHub repo that are PHP using GitHub API?
[英]GitHub's GraphQL API: How can I get all of the commits I've contributed to a particular public repo?
我正在尝试查询GitHub的GraphQL API(v4)。 此API的哪些GraphQL查询可用于获取我为特定公共回购贡献的所有提交?
我想出了解决方案。 (下面显示的解决方案用于从master
获得相关的提交,但是可以轻松地将其修改为其他qualifiedName
值。)
首先,执行初始查询以获取用户ID:
query {
viewer {
id
}
}
然后,可以使用以下查询将所有贡献提交到特定存储库:
query($repository_owner:String!, $repository_name:String!, $user_id:ID!) {
repository(owner: $repository_owner, name: $repository_name) {
ref(qualifiedName: "master") {
target {
... on Commit {
history(author: {id: $user_id}) {
totalCount
nodes {
id
authoredDate
message
}
}
}
}
}
}
}
查询变量采用以下形式:
{
"repository_owner": "REPOSITORY_OWNER_STRING",
"repository_name": "REPOSITORY_NAME_STRING",
"user_id": "USER_ID_FROM_STEP_1"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.