mirror of
https://github.com/status-im/gitpivot.git
synced 2026-08-27 16:41:08 +00:00
22 lines
657 B
Python
22 lines
657 B
Python
import sys
|
|
import json
|
|
import urllib
|
|
import argparse
|
|
from collections import defaultdict
|
|
|
|
|
|
auth = "?client_id=&client_secret="
|
|
|
|
|
|
repo = sys.argv[1]
|
|
pr = sys.argv[2]
|
|
link_pulls_commits = "https://api.github.com/repos/" + repo + "/pulls/" + pr + "/commits" +auth
|
|
points = defaultdict(int)
|
|
commits = json.load(urllib.urlopen(link_pulls_commits))
|
|
for commit in commits:
|
|
if(commit['url']):
|
|
link_commit = json.dumps(commit['url'])[1:-1] +auth
|
|
_commit = json.load(urllib.urlopen(link_commit))
|
|
author = json.dumps(_commit['author']['login'])[1:-1]
|
|
points[author] += int(json.dumps(_commit['stats']['total']))
|
|
print points.items() |