Last active
July 7, 2020 19:37
-
-
Save dimastatz/9fc3253102f8050ce5b85645d3a28e4d to your computer and use it in GitHub Desktop.
This file contains 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
def is_prod_bump(p: PullRequest.PullRequest): | |
files = [x for x in p.get_files() if 'tags-info.json' in x.filename] | |
return len(files) > 0 | |
def get_changes(p: PullRequest.PullRequest): | |
from functools import reduce | |
res = [[x.additions, x.changes, x.deletions] for x in p.get_files()] | |
return reduce(lambda x,y: [x[0] + y[0], x[1] + y[1], x[2] + y[2]],res) | |
def get_comment_time(p: PullRequest.PullRequest): | |
from datetime import datetime | |
return str(min([x.created_at for x in p.get_comments()], default=datetime.min)) | |
def get_merged_prs(repo: Repository.Repository): | |
prs = (x for x in repo.get_pulls(state='closed') if x.merged) | |
return ([x.user.name, x.comments, x.commits, str(parse(x.last_modified)), | |
str(x.created_at), get_comment_time(x), is_prod_bump(x)] + get_changes(x) for x in prs) | |
def get_all_data(o: Organization.Organization): | |
return (m for r in o.get_repos() for m in get_merged_prs(r)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment