Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github graphql query for project contributors

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!

like image 330
Piotr Kaliński Avatar asked Sep 19 '17 20:09

Piotr Kaliński


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.

like image 143
sreenivas Avatar answered Oct 23 '22 12:10

sreenivas


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",
like image 33
q3e Avatar answered Oct 23 '22 12:10

q3e