简体   繁体   English

Github GraphQL API 获取用户的所有提交

[英]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.

相关问题 GitHub的GraphQL 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 查询单个存储库中的所有提交 - Querying all commits in a single repository with the GitHub GraphQL API v4 使用Github GraphQL API按消息搜索提交? - Search commits by message with Github GraphQL API? 高效的 GraphQL 查询通过 GitHub 的 v4 API 检索存储库中的所有提交? - Efficient GraphQL query to retrieve ALL commits in a repository via GitHub's v4 API? 使用 GitHub GraphQL API,如何获取文件的大小以随着时间的推移提交? - With the GitHub GraphQL API, how do I get the size of a file for commits over time? Github GraphQl - 如何获取标签之间的提交列表 - Github GraphQl - How to get a list of commits between tags GitHub GraphQL:获取存储库的所有分支 - GitHub GraphQL: Get all forks of a repository 使用GitHub API v4 GraphQL查找属于用户拥有的存储库的所有未解决问题 - Using GitHub API v4 GraphQL to find all open issues belonging to repositories owned by the user GitHub GraphQL API:获取提交的标签 - GitHub GraphQL API: Get tags for a commit 使用 Graphql 和 Github API 获取仓库信息 - Using Graphql and Github API to get repository information
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM