jacobian/django-dev-dashboard — pull request #9 by gwrtheyrn (2012-06-07 11:22:21+00:00)
Title: Github Stats

:sparkles: Awesome Github stats! :sparkles:

I already added pull request stats to the fixture file (which takes forever to load btw).

To add them and some other cool stats to an existing database:

GithubItemCountMetric.objects.create(
name=u'Pull Requests (Open)',
slug='pull-requests-open',
period='instant',
unit=u'pull request',
unit_plural=u'pull requests',
link_url='https://github.com/django/django/pulls',
api_url='https://api.github.com/repos/django/django/pulls?state=open')
GithubItemCountMetric.objects.create(
name=u'Pull Requests (Closed)',
slug='pull-requests-closed',
period='instant',
unit=u'pull request',
unit_plural=u'pull requests',
link_url='https://github.com/django/django/pulls',
api_url='https://api.github.com/repos/django/django/pulls?state=closed')

GithubItemCountMetric.objects.create(
name=u'Github Contributors',
slug='github-contributors',
period='instant',
unit=u'contributor',
unit_plural=u'contributors',
link_url='https://github.com/django/django/graphs/contributors',
api_url='https://api.github.com/repos/django/django/contributors')
GithubItemCountMetric.objects.create(
name=u'Github Forks',
slug='github-forks',
period='instant',
unit=u'fork',
unit_plural=u'forks',
link_url='https://github.com/django/django/network',
api_url='https://api.github.com/repos/django/django/forks')
GithubItemCountMetric.objects.create(
name=u'Github Watchers',
slug='github-watchers',
period='instant',
unit=u'watcher',
unit_plural=u'watchers',
link_url='https://github.com/django/django/watchers',
api_url='https://api.github.com/repos/django/django/watchers')

Note that I didn't catch the Github API rate limit (which is 5000 requests per hour).