github graphql query for project contributors

Viewed 1997

I want to query using GitHub Graphql api for project contributors, can anyone give me any hints how to make it? Just been trying for some time, and I guess that I am missing some small element.

I'd like to get sth like https://api.github.com/repos/facebook/react/contributors?page=15 but only for amount of conttributions

Greetings!

2 Answers

updated: May, 2020.

Github GraphQL API currently don't support getting contributors of a repo.

You can get the collaborators though....

query {
  repository(owner: "peek", name: "peek") {
    id
    name

    collaborators(first: 10, affiliation: ALL) {
      edges {
        permission
        node {
          id
          login
          name
        }
      }
    }
  }

  rateLimit {
    cost
  }
}

You need to have push rights to the repository to view the collaborators.

The Github graphql v4 API does not seem to support contributor nodes unless you have push access to a repo.

I get this error when i try to get a list of a repo's collaborators

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