Is there a way to get access to the data in the “Repositories contributed to” module on GitHub profile pages via the GitHub API? Ideally the entire list, not just the top fi
Using Google BigQuery with the GitHub Archive, I pulled all the repositories I made a pull request to using:
SELECT repository_url
FROM [githubarchive:github.timeline]
WHERE payload_pull_request_user_login ='rgbkrk'
GROUP BY repository_url;
You can use similar semantics to pull out just the quantities of repositories you contributed to as well as the languages they were in:
SELECT COUNT(DISTINCT repository_url) AS count_repositories_contributed_to,
COUNT(DISTINCT repository_language) AS count_languages_in
FROM [githubarchive:github.timeline]
WHERE payload_pull_request_user_login ='rgbkrk';
If you're looking for overall contributions, which includes issues reported use
SELECT COUNT(DISTINCT repository_url) AS count_repositories_contributed_to,
COUNT(DISTINCT repository_language) AS count_languages_in
FROM [githubarchive:github.timeline]
WHERE actor_attributes_login = 'rgbkrk'
GROUP BY repository_url;
The difference there is actor_attributes_login
which comes from the Issue Events API.
You may also want to capture your own repos, which may not have issues or PRs filed by yourself.
I tried implementing something like this a while ago for a Github summarizer... My steps to get the repositories the user contributed to, which they didn't own, was as follows (going to use my own user as an example):
https://api.github.com/search/issues?q=type:pr+state:closed+author:megawac&per_page=100&page=1
https://api.github.com/repos/jashkenas/underscore/contributors
repos/:owner/:repo/contributors
https://api.github.com/users/megawac/subscriptions
https://api.github.com/users/megawac/orgs
https://api.github.com/orgs/jsdelivr/repos
This misses repos where the user has submitted no pull requests but has been added as a contributor. We can increase our odds of finding these repos by searching for
1) any issue opened (not just closed pull requests)
2) repos the user has starred
Clearly, this requires many more requests than we would like to make but what can you do when they make you fudge features \o/
As of now GitHub API v3, doesn't provide a way to get the user's current streak.
You may use this to calculate the current streak.
https://github.com/users/<username>/contributions.json
There is a new project that claims to list all contributions:
https://github.com/AurelienLourot/github-contribs
It also backs a service to produce more detailed user profiles:
https://ghuser.io/