skip to Main Content

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!

3

Answers


  1. 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.

    Login or Signup to reply.
  2. 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",
    
    Login or Signup to reply.
  3. The closest match to get the equivalent of v3 REST API url /repos/$USER/$REPO/contributors i could find is:

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

    It seems to count all contributors in a repository that could be matched to Github users (most probable through their emails).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search