Contributors of a repository


#1

I’m trying to get contributors of repositories, but while I’am looking for collaborators I need permission access. Is it possible to get from collaborators just contributors?

query{
  organization(login:"angular") {
    name
   
    repositories(first:10 orderBy:{field:NAME, direction:ASC} ) {
      totalCount
      edges {
        node {
          id
          name
          description
          collaborators(first: 10, affiliation: ALL) {
          totalCount
              edges {
                 permission
                node {
                   id
                   login
                   name
        }
      }
    } 
  }

}
}
}
}


#2

Hi @JakubJakubowski8,

It isn’t currently possible to access repository contributors from the GraphQL API. However, we’re aware that others in the past have requested that it be added to our schema:

Thus, it isn’t possible to get contributors from a list of collaborators.

Hope that helps!


#3

Uh, this whole graphql thing is so frustrating. Wasting hours on trying to get something to work, and to then discover it’s not supported yet. Is there any one-page document outlining what is supported and what is not? It seems graqph has been rolled out way too early. It’s impossible to fully switch to graphql, making it overly complicating stitching API 3 with GraphQL together…


#4

Hey @bartclaeys!

I see you responded in a few threads, but I’ll go ahead and drop my reply in here!

I’m sorry to hear that you’re not happy with our schema availability in GraphQL! I really do wish it was more complete, and it’s something that we’re actively working on in the first half of 2018. I wish we could have launched the API with 100% parity with our REST API, but given the breadth of what it offers, it’s not realistic - instead, we’ve been taking input from other parties and working on what is most important to them.

Because GraphQL is self-documenting, my recommendation would be to use something like the GraphQL Explorer to look at the currently available schema or pull it up on our GraphQL APIv4 Documentation Site. This will allow you to take a look at what objects are available at a glance, and should go a long way to helping you predict what you can’t access!


#5

Appreciate your response. Not sure if going the graphql route is a smart thing to be honest. REST APIs are pretty easy to understand, but honestly this whole graphql thing feels overcomplicated. It’s like you’re re-inventing the wheel, and I see tons of challenges. Yet another new syntax I need to master (I’m creating online products and services, I care more about the UX than about the hype of using the latest coding trend). Suddenly I need to learn up about edges, nodes, fragments etc. Come on! There are tons of query languages, do we really need yet another one? Why not default to regular SQL, that something that’s logic and widely understood. Summarized: Disappointed in graphql, seems hype, the learning curve stands in the way of the benefits of graphql.


Can't access the contributors of a repository
#6

Hey!

Thanks for the input! I’m not sure if there’s much I can say, given your disappointment seems to go down as deep as technologies that we’ve chosen, which isn’t something that’s actionable for us right now. I appreciate the insight, and if you’re ever up for it I would love to sit down and figure out what parts of our GraphQL API were enough to steer you away from the tech.

The introduction of any new technology definitely has a learning curve, which naturally creates friction when trying to adopt it. Our goal with GraphQL was not to be ‘hype’, but to provide a richer option for people to integrate against and provide new access methods beyond a single-resource REST API. Of course, it’s not going to meet every use case - when I drop down to cURL to make a quick query to GitHub, I still use our REST v3 API because I think it’s much better suited for things like that - which is why it’s not going away any time soon! On the other hand, you have the capability today of executing GraphQL queries that would take hundreds to thousands of individual REST calls, all in one 3 second request!

One of the reasons that we decided to adopt GraphQL was to avoid exactly the problem you mentioned: not creating another query language. Instead, we adopted a language that has been in production at companies like Facebook and Twitter for a good amount of time and has a rapidly growing community that’s created fantastic integrations and tooling around it. While it would be cool to create an ANSI SQL API to GitHub, that approach would likely be even more complex than a GraphQL implementation and come with a large set of problems that would be completely unique to GitHub.

It saddens me that we weren’t able to win you over with our new GraphQL API, and I hope that at some point you’ll give it another chance - I know it’s got some awesome capabilities, and I’d be more than happy to take a look at anything you need that we’re missing!


#7

Thanks for your extensive reply. I am currently using REST API v3 in combination with GraphQL. The parts using GraphQL work great, but creating the queries requires a lot of research and a significant amount of time goes towards understanding GraphQL. The fact that not everything the REST API offers is available in GraphQL complicates things even more, because while learning, things fail which I blame on my lack of understanding of GraphQL to then discover this specific call is not supported. But it’s good to hear that GraphQL won’t be replacing the REST API anytime soon. That would be my worry, creating an app that needs to be refactored in the future when REST API gets deprecated. What would be helpful, would be concrete query examples.


#8

I don’t currently see a way to sort by top committers. It would be wonderful to be able to see who has contributed to a repository most recently and who has contributed to a repository most often. Is there a way to do this that I’m not understanding?


#9

Any updates on this? Possible to get top contributors via the API?


#10

Same @dustinmichels - would love to have an update on this. @nickvanw?


#11

Same here, I am trying to get the total count of contributors, and even with REST, it is pretty cumbersome and eat on rate limit pretty fast.

Btw, I started to look at GraphQL and it is pretty nice and planning to use it instead, but really would like to have a way to get the total Number of contributors (just the number of the website would be a good start. It’s an important metric, and feels like Github already has this data, and could just add it as a field of Repository (just thinking out loud).


#12

This has been an open issue with the Github GraphQL API for over a year now. What’s really frustrating is that I now maintain two different API implementations for github for my system – one REST and one GraphQL. I would love to move completely to GraphQL API, but since it is still incomplete, I can’t. Is implementing contributors to a repo in the graphQL API really all that difficult, or is it just a matter of prioritization of features?