(Also, this isn't counting people who contribute to the mobile projects
on GitHub, and really the final monthly report stat ought to.  I don't
quickly see a way to ask "how many unique contributors submitted unique
pull requests to a https://github.com/wikimedia/ repo in June?" on
GitHub, though, so I'll put that off till next month.)

I was bored, so I made you a Python script this time :)

It's attached, it takes a year and month as its arguments, and fetches all the repos at github/wikimedia, then fetches their pull requests, and then finally checks to see which pull requests match the month you specified. Something like

$ ./githubunique 2012 06 # should give "3 unique contributors"

And yes, most months only have very few contributors, but anything we can do to increase the count :)

It also doesn't count people who are making operations changes, or
Wikimedia site configuration changes, or are packaging debs, etc, etc.
It would be awesome to see stats for those as well. I have a feeling
that we have more contributors then the record ;).

This should be as simple as removing the "project:^mediawiki.*" bit from the previous bash script. I'm not sure if there are other bots to exclude in that case, though, so I'll leave it up to someone more versed with the rest of Gerrit (Ryan?)

If there are other github repositories *not* in the wikimedia github account, it shouldn't be hard to add those to the consideration in this script.

P.S., a word to the wise: don't try to parse github's API requests with bash, it's just not worth it.

P.P.S., for those who like unified counts, adding this python script to the end of the previous bash script should be easy enough, so you could get all of the contributors (95!) in one command if you wanted.

--
Mark Holmquist
Contractor, Wikimedia Foundation
mtrac...@member.fsf.org
http://marktraceur.info
#!/usr/bin/env python

import urllib2
import json
import datetime
import sys

reposurl = 'https://api.github.com/users/wikimedia/repos'
pullbaseurl = 'https://api.github.com/repos/wikimedia/'
pullafterurl = '/pulls?state='

year = sys.argv[1]
month = sys.argv[2]

text = urllib2.urlopen( reposurl ).read()
repos = json.loads( text )
uniqs = {}

for repo in repos:
    for state in ['open', 'closed']:
        pullurl = pullbaseurl + repo['name'] + pullafterurl + state
        text = urllib2.urlopen( pullurl ).read()
        pulls = json.loads( text )
        for pull in pulls:
            pulldate = pull['created_at'][0:7].split( '-' )
            if pulldate[0] != year or pulldate[1] != month:
                continue
            uniqs[pull['head']['repo']['owner']['login']] = True

count = 0
for uniq in uniqs.keys():
    print uniq
    count += 1

print str( count ) + ' unique contributors in that month.'
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to