Retrieving the last year of commit activity data

According to GitHub documentation, you can retrieve the last year of commit activity data PER repository by GET /repos/owner/repo/stats/commit_activity. This can be done by:

var request = require('request');var options ={ url:'https://api.github.com/repos/name/project/stats/commit\_activity', headers:{'User-Agent':'request'}};function callback(error, response, body){var jsonBody = JSON.parse(body); console.log(JSON.stringify(jsonBody,null,2));}request(options, callback);

Another example you can retrieve the weekly commit count for the repository owner and everyone else by GET /repos/owner/repo/stats/participation but it is still done PER repository, which is not what I want.

The problem is I need the commit activity of  each week  of last year for ALL the repositories (excluding and including collaborators). How is this done?

Hi @benjaminsunderland,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our Community organized so users can more easily find information.

As you’ll notice, your Topic is now in the How to use Git and GitHub board. No action is needed on your part; you can continue the conversation as normal here.

Cheers!

There isn’t a single API call for what you’re asking. You would have to use the appropriate API for listing the repositories for a user or organization and then iterate through each one with the code you already have. Be certain to craft your code to keep within the rate limits. I would also recommend, if this is something you’re going to be doing regularly, caching or storing the results so that you’re not recalculating things already calculated.

I hope that helps!