【问题标题】:github graphql query for project contributors项目贡献者的 github graphql 查询
【发布时间】:2020-05-01 09:37:41
【问题描述】:

我想使用 GitHub Graphql api 查询项目贡献者,谁能给我任何提示如何制作它?刚刚尝试了一段时间,我想我错过了一些小元素。

我想得到https://api.github.com/repos/facebook/react/contributors?page=15 这样的东西,但只是为了贡献数量

您好!

【问题讨论】:

  • github... 现在支持查询贡献者。更新我的答案。谢谢!

标签: github graph graphql github-graphql


【解决方案1】:

Github graphql v4 API 似乎不支持贡献者节点,除非您拥有对存储库的推送访问权限。

当我尝试获取 repo 的合作者列表时出现此错误

"errors": [
{
  "message": "Must have push access to view repository collaborators.",
  "type": "FORBIDDEN",

【讨论】:

    【解决方案2】:

    更新日期:2020 年 5 月。

    Github GraphQL API 目前不支持获取contributors 的 repo。

    不过你可以得到collaborators....

    query {
      repository(owner: "peek", name: "peek") {
        id
        name
    
        collaborators(first: 10, affiliation: ALL) {
          edges {
            permission
            node {
              id
              login
              name
            }
          }
        }
      }
    
      rateLimit {
        cost
      }
    }
    

    您需要拥有仓库的推送权限才能查看协作者。

    【讨论】:

    • 这是合作者,不是贡献者。您无法(截至 2018 年 4 月)通过 GraphQL API 获得等效于 /repos/$USER/$REPO/contributors 的 v3 API。
    • 这不是解决方案。合作者展示的内容超出我的预期。在网页上,我只看到给定存储库的 2 个协作者,而 api 返回更多。
    • 我更新了答案以反映状态谢谢迈克尔和马可
    猜你喜欢
    • 2019-07-30
    • 1970-01-01
    • 1970-01-01
    • 2022-01-27
    • 1970-01-01
    • 2012-11-06
    • 2018-07-28
    • 1970-01-01
    • 2011-09-13
    相关资源
    最近更新 更多