forked from scalameta/metals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmerged_prs.py
32 lines (24 loc) · 833 Bytes
/
merged_prs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from github import Github
import subprocess
import re
PIPE = subprocess.PIPE
gh = Github()
# Needed data
first_tag = "v0.7.5"
last_tag = "v0.7.6"
# Running
org = gh.get_organization('scalameta')
repo = org.get_repo('metals')
tag_range = "%s..%s" % (first_tag, last_tag)
command = ['git', 'log', tag_range, "--merges", "--first-parent", "master", "--pretty=format:\"%s\""]
process = subprocess.Popen(command, stdout=PIPE, stderr=PIPE)
stdoutput, stderroutput = process.communicate()
all_prs = []
for line in stdoutput.split("\n"):
pr_num = re.findall("#\d+", line)
all_prs.append(int(pr_num[0][1:]))
for pr in all_prs:
pull = repo.get_pull(pr)
print ("- %s" % pull.title)
print ("[\#%s](%s)" % (pull.number, pull.html_url))
print ("([%s](https://github.com/%s))" % (pull.user.login, pull.user.login))