update release notes auto generator

This commit is contained in:
parrt 2017-12-08 13:07:59 -08:00
parent 763a1242b7
commit 5c112be2ab
1 changed files with 43 additions and 28 deletions

View File

@ -2,6 +2,7 @@
# Exec with "python github_release_notes.py YOUR_GITHUB_API_ACCESS_TOKEN 4.7.1"
from github import Github
from collections import Counter
import sys
TARGETS = ['csharp', 'cpp', 'go', 'java', 'javascript', 'python2', 'python3', 'swift']
@ -18,32 +19,46 @@ milestone = milestone[0]
issues = repo.get_issues(state="closed", milestone=milestone, sort="created", direction="desc")
# dump bugs fixed
# # dump bugs fixed
# print()
# print("## Issues fixed")
# for x in issues:
# labels = [l.name for l in x.labels]
# if x.pull_request is None and not ("type:improvement" in labels or "type:feature" in labels):
# print("* [%s](%s) (%s)" % (x.title, x.html_url, ", ".join([l.name for l in x.labels])))
#
#
# print()
# # dump improvements closed for this release (issues or pulls)
# print("## Improvements, features")
# for x in issues:
# labels = [l.name for l in x.labels]
# if ("type:improvement" in labels or "type:feature" in labels):
# print("* [%s](%s) (%s)" % (x.title, x.html_url, ", ".join(labels)))
#
# print()
#
#
# # dump PRs closed for this release by target
# print("## Pull requests grouped by target")
# for target in TARGETS:
# print()
# print(f"### {target} target")
# for x in issues:
# labels = [l.name for l in x.labels]
# if x.pull_request is not None and f"target:{target}" in labels:
# print("* [%s](%s) (%s)" % (x.title, x.html_url, ", ".join(labels)))
#
# dump contributors
print()
print("## Issues fixed")
for x in issues:
labels = [l.name for l in x.labels]
if x.pull_request is None and not ("type:improvement" in labels or "type:feature" in labels):
print("* [%s](%s) (%s)" % (x.title, x.html_url, ", ".join([l.name for l in x.labels])))
print()
# dump improvements closed for this release (issues or pulls)
print("## Improvements, features")
for x in issues:
labels = [l.name for l in x.labels]
if ("type:improvement" in labels or "type:feature" in labels):
print("* [%s](%s) (%s)" % (x.title, x.html_url, ", ".join(labels)))
print()
# dump PRs closed for this release by target
print("## Pull requests grouped by target")
for target in TARGETS:
print()
print(f"### {target} target")
for x in issues:
labels = [l.name for l in x.labels]
if x.pull_request is not None and f"target:{target}" in labels:
print("* [%s](%s) (%s)" % (x.title, x.html_url, ", ".join(labels)))
print("## Contributors")
user_counts = Counter([x.user.login for x in issues])
users = {x.user.login:x.user for x in issues}
for login,count in user_counts.most_common(10000):
name = users[login].name
logins = f" ({users[login].login})"
if name is None:
name = users[login].login
logins = ""
print(f"* {count:3d} items: [{name}]({users[login].html_url}){logins}")