Using GitHub's GraphQL API (v4), how do I query for the top contributors of a given repository? I have a list of repositories and I'd like to display some relevant data for each repository–namely, the top 5 contributors (based on commits) for each repository in the list.
Here is my current query:
{
organization(login: "the-road-to-learn-react") {
id
repositories(first: 20) {
edges {
node {
collaborators(affiliation: ALL) {
edges {
node {
name
}
}
}
}
}
}
}
}
I'm running into the error: "Must have push access to view repository collaborators". My thought is to get all of the collaborators for each repository, then query each of those users for the number of contributions made to the repository. How can this be done? Is there a way to do this without querying for repository collaborators?