[英]Github GraphQL API Get all commits of a User
I'm trying to use the GitHub GraphQL API to get all the additions made by a user (additions can be found from their commits).我正在尝试使用 GitHub GraphQL API 来获取用户所做的所有添加(可以从他们的提交中找到添加)。 I've been able to get the additions from pull requests, but I haven't found a way to do the same for commits.
我已经能够从拉取请求中获得添加,但我还没有找到一种方法来为提交做同样的事情。 How can I get all the commits from a user?
如何获取用户的所有提交?
This is my query (I am new to GraphQL):这是我的查询(我是 GraphQL 的新手):
query AllAdditions($username: String!, $from: DateTime, $to: DateTime) {
user(login: $username) {
name
contributionsCollection(from: $from, to: $to) {
commitContributionsByRepository(maxRepositories: 100) {
repository {
nameWithOwner
}
contributions(first: 30) {
totalCount
# I'm trying to get additions like this, but there is no 'commit' field
# nodes {
# commit {
# additions
# }
# }
}
}
pullRequestContributionsByRepository(maxRepositories: 100) {
repository {
nameWithOwner
}
contributions(first: 30) {
nodes {
pullRequest {
additions
}
}
}
}
}
}
}
{
search(query: "org:test", type: REPOSITORY, last: 100) {
nodes {
... on Repository {
name
defaultBranchRef {
name
target {
... on Commit {
history(first: 100, since: "2013-07-11T00:00:00") {
totalCount
nodes {
... on Commit {
committedDate
additions
author {
name
email
}
}
}
}
}
}
}
}
}
}
}
As for getting all orgs, there isn't currently a way to do that via the GraphQL API because the search connection requires something in the search query.至于获取所有组织,目前没有办法通过 GraphQL API 来做到这一点,因为搜索连接需要搜索查询中的某些内容。 There's also no top-level connection that allows you to list all users, orgs, or repositories.
也没有允许您列出所有用户、组织或存储库的顶级连接。
I hope that helps!我希望这会有所帮助!
answer copied from this URL: GraphQL - Get all commits by all users从此 URL 复制的答案: GraphQL - 获取所有用户的所有提交
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.