Reputation: 682
I've been poking through the GitHub API documentation and I can't seem to find a way to get the data that powers the "Contribution Activity" section and the contribution chart for a user's profile. Is there a way to get this through the API?
I know that there are user/:user/events
and /recieved_events
endpoints, but these seem to mostly consist of when the user stars repositories. I'm uninterested in the actual information of which repository/what commit/etc, but only interested in getting a time-series (or something like that) of commit/issue/etc. activity data that forms the contribution chart and activity portions of the profile page. Ideally numbers across all Github activity regardless of which repo/repo privacy/etc.
All I'm trying to do is incorporate this into my Github pages website.
Upvotes: 9
Views: 9926
Reputation: 311
Most contribution data can be fetched using Github GraphQL API - https://developer.github.com/v4/
I was using this method for doing a widget that shows the last user contributions list. And it works well and offers many of filtering/grouping opportunities
a.e you can get contribs count by day:
{
user(login: "orn0t") {
contributionsCollection {
contributionCalendar {
totalContributions
weeks {
contributionDays {
contributionCount
weekday
date
}
}
}
}
}
}
If you're looking for working code examples:
you can view my project on Github - https://github.com/orn0t/gh-contrib-widget.
Upvotes: 15