Last active
August 29, 2015 14:20
-
-
Save afeld/9488c0a7dc7762311c9d to your computer and use it in GitHub Desktop.
GitHub org outside contribution stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# goals: | |
# | |
# * find how frequently others contributed (issues or whatever) | |
# * how many contributors there are | |
# | |
# relevant links: | |
# | |
# * https://gist.github.com/afeld/017862706282c10edb6e | |
# * http://octoboard.com/ | |
# * http://bitergia.com/index.html | |
# * http://areweamillionyet.org/ | |
# * https://developer.github.com/v3/repos/statistics/#contributors | |
require 'octokit' | |
TOKEN = ENV.fetch('GITHUB_TOKEN') | |
ORG = '18F' | |
HOME_TEAM = '18f' | |
Octokit.auto_paginate = true | |
client = Octokit::Client.new(access_token: TOKEN) | |
teams = client.org_teams(ORG) | |
team = teams.find {|t| t.slug.downcase == HOME_TEAM.downcase } | |
teammates = client.team_members(team.id) | |
teammate_logins = teammates.map(&:login).to_set | |
outside_contributors_by_repo = Hash.new { [] } | |
repos = client.org_repos(ORG, type: 'public') | |
repos.each do |repo| | |
# TODO include the forks, but not the contributors from the original | |
next if repo.fork | |
contributors = client.contributors(repo.full_name) | |
outside_contributors = contributors.reject {|c| teammate_logins.include?(c.login) } | |
if outside_contributors.size > 0 | |
outside_contributors_by_repo[repo] = outside_contributors | |
end | |
print '.' | |
end | |
commits_by_contributor = Hash.new(0) | |
puts "\n\nOutside contributors by project:\n\n" | |
sorted_outside_contributors_by_repo = outside_contributors_by_repo.sort_by{|k,v| -v.size } | |
sorted_outside_contributors_by_repo.each do |repo, outside_contributors| | |
num_contributors = outside_contributors.size | |
if num_contributors > 0 | |
print num_contributors.to_s.rjust(6) | |
print ' ' | |
puts repo.name | |
end | |
outside_contributors.each do |contributor| | |
commits_by_contributor[contributor.login] += contributor.contributions | |
end | |
end | |
puts "\n\nCommits by contributor:\n\n" | |
# put in descending order | |
sorted_commits_by_contributor = commits_by_contributor.sort_by{|k,v| -v} | |
sorted_commits_by_contributor.each do |login, num_commits| | |
print num_commits.to_s.rjust(6) | |
print ' ' | |
puts login | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Outside contributors by project: | |
22 hourofcode | |
21 answers | |
15 midas | |
12 API-All-the-X | |
12 18f.gsa.gov | |
10 api-standards | |
7 18f.github.io | |
5 dashboard | |
5 myusa | |
5 analytics-reporter | |
3 peacecorps-site | |
3 api.data.gov | |
2 PriceHistoryAuth | |
2 accessibility | |
2 openFEC-web-app | |
2 omniauth-myusa | |
2 domain-scan | |
2 ifgovthenthat | |
2 jekyll_pages_api | |
2 PriceHistoryAPI | |
2 notalone | |
2 fbopen | |
1 parse-shopping-list | |
1 PriceHistoryInstall | |
1 afsbirez | |
1 RandomizeBasedOnZipcodeFromIPAddress | |
1 C2 | |
1 foia | |
1 bronto | |
1 fbopen-docs | |
1 cookbooks | |
1 foia-design | |
1 javascript-lessons | |
1 doi-extractives-data | |
1 beckley | |
1 openFEC | |
1 aaa-exp-proto1 | |
1 scrapebox | |
1 consulting | |
1 sbhub | |
1 hackathontrainingday | |
1 how-to-work-with-18f | |
1 Sendak | |
1 shipper | |
1 afsmallbiz | |
1 pif3-oct-apprentice | |
1 pif3-oct-whibrary | |
1 rdbms-subsetter | |
1 sendak-usage | |
1 email-to-github-issues | |
1 Mario | |
1 API-Usability-Testing | |
1 hub | |
1 MicroP3ApiUser | |
1 hash-joiner | |
1 docker-fugacious | |
1 PriceHistoryGUI | |
1 navy-reserve | |
1 automated-testing-playbook | |
1 MorrisDataDecorator | |
1 tock | |
1 hackathons | |
1 urlsize | |
1 laptop | |
1 dotgov-dashboard | |
1 d3-technical-debt | |
1 financial-models | |
1 508-procurement-playbook | |
Commits by contributor: | |
1130 polastre | |
504 RobertLRead | |
471 janearc | |
384 hale | |
211 CDainMiller | |
187 mapmeld | |
180 dwcaraway | |
116 pui | |
111 brandtheisey | |
99 RyanRusnak | |
97 cshold | |
93 JCody | |
88 snajmi | |
78 adam-at-mobomo | |
70 mick | |
69 amirbey | |
59 DanKottke | |
59 tmiyajima | |
53 mikefab | |
40 shawnjohnson | |
36 dianavtran | |
35 tranhelen | |
33 tdlowden | |
24 phae | |
23 joelmahoney | |
22 eddietejeda | |
22 jtexnl | |
18 rebeccawilliams | |
15 sefk | |
15 esonderegger | |
11 parkr | |
11 bryanhirsch | |
9 TravisCarden | |
9 hlieberman | |
8 monkbroc | |
7 csarsam | |
7 katucker | |
7 drewbailey | |
7 bkautter | |
5 mekarpeles | |
5 greggersh | |
5 phildini | |
5 dorianjp | |
4 jflasher | |
4 benbalter | |
4 aifoS1 | |
4 rpylipow | |
4 nvembar | |
3 ezoehunt | |
3 kshimabukuro | |
3 nneditch | |
3 fureigh | |
3 waldoj | |
3 GabeIsman | |
3 dutchashell | |
3 adp04c | |
3 vgraubard | |
2 marks | |
2 carlthewebmaster | |
2 anmartin | |
2 saracope | |
2 paultag | |
2 ealsheimer | |
2 sshami | |
2 joewiz | |
2 sferik | |
2 invalid-email-address | |
2 laurenancona | |
2 lazysoundsystem | |
2 abosio | |
2 jrep | |
2 ascott1 | |
2 jzeng808 | |
2 lbarton | |
2 GeekOnCoffee | |
1 wpears | |
1 nicoleozamalin | |
1 philipharding | |
1 lesmith | |
1 joenovak | |
1 irildbn | |
1 rmotamed1GSA | |
1 gplocke | |
1 carloseberhardt | |
1 wardi | |
1 jabley | |
1 LenaTrudeau | |
1 snikch | |
1 bengm | |
1 hokieshuffle | |
1 heheinrich | |
1 arthurnn | |
1 edward | |
1 coosh | |
1 spoonstein | |
1 47ronin | |
1 gcopm | |
1 blacyc0987 | |
1 afeldtest | |
1 Tangherlini | |
1 Sevenneves | |
1 mereastew | |
1 HobokenMartha | |
1 kmt | |
1 jobrieniii | |
1 Dominic-MP | |
1 cliftonmcintosh | |
1 MarthaP | |
1 ajschumacher | |
1 brookeheaton | |
1 KarenTreble | |
1 boblannon | |
1 pborreli | |
1 joyfulton | |
1 GiaRiv | |
1 gitter-badger | |
1 samiraagarwal | |
1 solidaction | |
1 polinadotio | |
1 bellalucy | |
1 edsu | |
1 tybrickhouse | |
1 corizarek | |
1 loren | |
1 nkapur01 | |
1 makaimc | |
1 medina | |
1 itruett | |
1 jessieay | |
1 ozzy-io | |
1 nathantypanski | |
1 maxogden | |
1 croaky | |
1 fjohnson11 | |
1 stvnrlly |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment