github 项目贡献者的 graphql 查询

github graphql query for project contributors

我想使用 GitHub Graphql api 为项目贡献者查询,任何人都可以给我一些提示吗?刚刚尝试了一段时间,我想我遗漏了一些小元素。

我想获得类似 https://api.github.com/repos/facebook/react/contributors?page=15 的东西,但仅限于贡献数量

您好!

更新时间: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
  }
}

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

Github graphql v4 API 似乎不支持贡献者节点,除非你有对 repo 的推送访问权限。

当我尝试获取存储库的协作者列表时出现此错误

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