Hello,
I’ve recently started using the GraphQL API. And it’s not too bad, but I am confused about a couple of things.
I’m using the following query, and although it provides most of the totals it seems to be missing any means for obtaining the total number of commits.
Here’s the query I’m using:
{
user(login: "jxmot") {
name
login
contributionsCollection {
hasAnyContributions
contributionYears
}
repositoriesContributedTo(first: 100) {
totalCount
}
pullRequests(first: 1) {
totalCount
}
issues(first: 1) {
totalCount
}
followers {
totalCount
}
# how do you get the total commits?
}
}
I’ve examined the documentation user schema and there doesn’t appear to be anything even close to “total commits”. And I’ve also tried the following, and also searched the docs:
user(login: "jxmot") {
name
login
# get the user's collection of repositories.
repositories(first: 100, isFork: false, ownerAffiliations: OWNER, orderBy: {direction: DESC, field: STARGAZERS}) {
totalCount
nodes {
forkCount
stargazerCount
# this does NOT have a separate "count" fields
watchers {
totalCount
}
}
}
}
}
But the only method that seems possible is to iterate through API calls like this:
#
{
user(login: "jxmot") {
contributionsCollection(from: "2020-01-01T06:00:00Z", to: "2020-12-31T05:59:59Z") {
# contributionsCollection(from: "2019-01-01T06:00:00Z", to: "2019-12-31T05:59:59Z") {
# contributionsCollection(from: "2018-01-01T06:00:00Z", to: "2018-12-31T05:59:59Z") {
# contributionsCollection(from: "2017-01-01T06:00:00Z", to: "2017-12-31T05:59:59Z") {
# contributionsCollection(from: "2016-01-01T06:00:00Z", to: "2016-12-31T05:59:59Z") {
startedAt
endedAt
hasActivityInThePast
# make subsequent calls to this query, change the dates each pass and total the following
totalCommitContributions
}
}
}
Is there a way I can retrieve the lifetime total quantity of commits per user without having to make multiple queries?
Thank You!