[feature_request] Add all time total commits object to GraphQL API #35675
Replies: 3 comments
-
I second the proposal as there is no other reliable way to fetch one's overall commits on GitHub.
Nope, it is inaccurate. Most kernel developers will probably not be in love with it as I've described in anuraghazra/github-readme-stats#564 (comment). curl -H "Accept: application/vnd.github.cloak-preview" https://api.github.com/search/commits\?q\=author:torvalds
|
Beta Was this translation helpful? Give feedback.
-
I concur with both prior posts. I also second the assessment in the second post, that the function(s) offered by GitHub's REST API do(es) not provide an alternative. |
Beta Was this translation helpful? Give feedback.
-
It would be nice to have this feature implemented. Currently, if you have commits in popular repos and they are copied (without fork), your commits will be counted multiple times, and the number of commits doesn't make sense anymore. |
Beta Was this translation helpful? Give feedback.
-
There is currently no easy way to fetch the all-time commits of a specific user using the GraphQL API. The current
user/contributionsCollection/totalCommitContributions
object of the GraphQL API will return the commit contributions per year (see contributionsCollection). Providing users to retrieve the all-time commit contributions without having to loop through all years would improve the GraphQL API.Current behaviour
Current graphQL query:
Current GraphQL variables
This will return the commits per year.
New behaviour
Making the
totalCommitContributions
andrestrictedContributionsCount
objects available under the user level would improve the behaviour.New graphQL query:
New GraphQL variables
Alternatives I considered
Github REST API
I can fetch the total commits of a user by using the commit search API to get this in a single request: https://developer.github.com/v3/search/#search-commits it has a
total_count
field.e.g.
but it has a rate limit of 30 queries per minute and sometimes fails.
Using github pagination
I can also use GraphQL pagination to loop through all ContributionsCollection.contributionYears. This however will take a long time and is in-accurate (see https://github.com/orgs/community/discussions/35675#discussioncomment-3844912).
Beta Was this translation helpful? Give feedback.
All reactions