The Repository Statistics API allows you to fetch the data that GitHub uses for visualizing different
types of repository activity.

A word about caching

Computing repository statistics is an expensive operation, so we try to return cached
data whenever possible. If the data hasn't been cached when you query a repository's
statistics, you'll receive a 202 response; a background job is also fired to
start compiling these statistics. Give the job a few moments to complete, and
then submit the request again. If the job has completed, that request will receive a
200 response with the statistics in the response body.

Repository statistics are cached by the SHA of the repository's default branch,
which is usually master; pushing to the default branch resets the statistics cache.

Get the last year of commit activity data

Returns the last year of commit activity grouped by week. The days array
is a group of commits per day, starting on Sunday.

GET /repos/:owner/:repo/stats/commit_activity

Response

Status: 200 OK

[{"days":[0,3,26,20,39,1,0],"total":89,"week":1336280400}]

Get the number of additions and deletions per week

GET /repos/:owner/:repo/stats/code_frequency

Response

Returns a weekly aggregate of the number of additions and deletions pushed
to a repository.

Status: 200 OK

[[1302998400,1124,-435]]

Get the weekly commit count for the repository owner and everyone else

GET /repos/:owner/:repo/stats/participation

Response

Returns the total commit counts for the owner and total commit counts in all.
all is everyone combined, including the owner in the last 52 weeks. If you'd like to get the commit
counts for non-owners, you can subtract owner from all.