【问题标题】:GraphQL : Searched with a keyword, provides a list of repositories and for each repository to provide the collaborators using github APIGraphQL :使用关键字搜索,提供存储库列表,并为每个存储库提供使用 github API 的协作者
【发布时间】:2019-10-19 21:12:42
【问题描述】:

使用关键字搜索存储库并在 git hub 中查找与该存储库关联的所有存储库,列出每个存储库的协作者。

使用关键字搜索存储库工作正常,我能够获得每个存储库的名称,但不是合作者, 有了它,我必须拥有查看协作者的推送权限。

查询{

rateLimit{
    cost
    remaining
    resetAt
}
search(query: "-js created:>2015-01-01 language:JavaScript", type:REPOSITORY, first: 20) {
    repositoryCount
    pageInfo {
        hasNextPage
        endCursor
        startCursor
    }
    edges {
        node {
            ... on Repository {
                name
                url
                collaborators(first: 100, affiliation: ALL)
              {
                edges{
                  node{
                    name
                  }
                }
              }
            }
        }
    }
}

如果我喜欢下面的内容,我将获得合作者,但我想使用搜索功能并获得仅搜索到的存储库的合作者。

{ 用户(登录:“xxxx”){

repositories(first: 100){
  nodes{

      name
      url
        collaborators(first:100,affiliation:ALL){
      nodes{
        name
      }
    }

  }
}

} }

【问题讨论】:

    标签: graphql github-api


    【解决方案1】:

    协作者是有权访问存储库的用户,除非您对该存储库具有一定的权限级别,否则这些用户是不可见的。我相信 GitHub REST API 也有同样的限制,这是出于隐私原因。

    相反,我认为您可能有兴趣查看贡献者,了解谁在项目中处于活跃状态。 GraphQL API 目前不支持此功能,但可从 REST API 获得:https://developer.github.com/v3/repos/statistics/#get-contributors-list-with-additions-deletions-and-commit-counts

    【讨论】:

      猜你喜欢
      • 2012-09-21
      • 1970-01-01
      • 2018-06-25
      • 2019-04-13
      • 2011-04-25
      • 2020-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多