mirror of
https://github.com/status-im/github-oracle.git
synced 2026-08-27 09:51:10 +00:00
changed abstract tokens to library link, oraclize to library link, introduced issues (not functional) and oraclize computation scripts
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
FROM ubuntu:14.04
|
||||
RUN apt-get update && apt-get install -y python
|
||||
ADD issue_status.py issue_status.py
|
||||
MAINTAINER Ricardo “3esmit@gmail.com”
|
||||
CMD python issue_status.py
|
||||
@@ -0,0 +1,24 @@
|
||||
import os, sys, json, urllib, datetime
|
||||
|
||||
print os.environ['ARG0']
|
||||
|
||||
if(len(sys.argv) < 3):
|
||||
print "too few arguments"
|
||||
sys.exit()
|
||||
|
||||
repo = sys.argv[1]
|
||||
issue = sys.argv[2]
|
||||
if(len(sys.argv) < 5):
|
||||
auth = ""
|
||||
else:
|
||||
client_id = sys.argv[3]
|
||||
client_secret = sys.argv[4]
|
||||
auth = "?client_id="+client_id+"&client_secret="+client_secret
|
||||
|
||||
link_issue = "https://api.github.com/repos/" + repo + "/issues/" + issue + auth
|
||||
issue = json.load(urllib.urlopen(link_issue))
|
||||
|
||||
if(issue['state'] == "closed"):
|
||||
print datetime.datetime.strptime( json.dumps(issue['closed_at'])[1:-1], "%Y-%m-%dT%H:%M:%SZ" ).strftime('%s') +","+ json.dumps(issue['closed_by']['login'])
|
||||
else:
|
||||
print "open"
|
||||
@@ -0,0 +1,20 @@
|
||||
import sys
|
||||
import json
|
||||
import urllib
|
||||
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()
|
||||
Reference in New Issue
Block a user