Add release note for 1.2.0 in NEWS.md (#6063)
* Update query_contributors.py to account for pagination * Add the release note for 1.2.0 * Add release note for patch releases * Apply suggestions from code review * Fix typo Co-authored-by: Jiaming Yuan <jm.yuan@outlook.com> Co-authored-by: John Zedlewski <904524+JohnZed@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
ada964f16e
commit
9be969cc7a
@@ -7,7 +7,8 @@ import requests
|
||||
import json
|
||||
|
||||
if len(sys.argv) != 5:
|
||||
print(f'Usage: {sys.argv[0]} [starting commit/tag] [ending commit/tag] [GitHub username] [GitHub password]')
|
||||
print(f'Usage: {sys.argv[0]} [starting commit/tag] [ending commit/tag] [GitHub username] ' +
|
||||
'[GitHub password]')
|
||||
sys.exit(1)
|
||||
|
||||
from_commit = sys.argv[1]
|
||||
@@ -18,31 +19,40 @@ password = sys.argv[4]
|
||||
contributors = set()
|
||||
reviewers = set()
|
||||
|
||||
def paginate_request(url, callback):
|
||||
r = requests.get(url, auth=(username, password))
|
||||
assert r.status_code == requests.codes.ok, f'Code: {r.status_code}, Text: {r.text}'
|
||||
callback(json.loads(r.text))
|
||||
while 'next' in r.links:
|
||||
r = requests.get(r.links['next']['url'], auth=(username, password))
|
||||
callback(json.loads(r.text))
|
||||
|
||||
for line in git.log(f'{from_commit}..{to_commit}', '--pretty=format:%s', '--reverse'):
|
||||
m = re.search('\(#([0-9]+)\)$', line.rstrip())
|
||||
if m:
|
||||
pr_id = m.group(1)
|
||||
print(f'PR #{pr_id}')
|
||||
|
||||
r = requests.get(f'https://api.github.com/repos/dmlc/xgboost/pulls/{pr_id}/commits', auth=(username, password))
|
||||
assert r.status_code == requests.codes.ok, f'Code: {r.status_code}, Text: {r.text}'
|
||||
commit_list = json.loads(r.text)
|
||||
try:
|
||||
contributors.update([commit['author']['login'] for commit in commit_list])
|
||||
except TypeError:
|
||||
contributors.update(str(input(f'Error fetching contributors for PR #{pr_id}. Enter it manually, as a space-separated list:')).split(' '))
|
||||
def process_commit_list(commit_list):
|
||||
try:
|
||||
contributors.update([commit['author']['login'] for commit in commit_list])
|
||||
except TypeError:
|
||||
prompt = (f'Error fetching contributors for PR #{pr_id}. Enter it manually, ' +
|
||||
'as a space-separated list: ')
|
||||
contributors.update(str(input(prompt)).split(' '))
|
||||
def process_review_list(review_list):
|
||||
reviewers.update([x['user']['login'] for x in review_list])
|
||||
def process_comment_list(comment_list):
|
||||
reviewers.update([x['user']['login'] for x in comment_list])
|
||||
|
||||
r = requests.get(f'https://api.github.com/repos/dmlc/xgboost/pulls/{pr_id}/reviews', auth=(username, password))
|
||||
assert r.status_code == requests.codes.ok, f'Code: {r.status_code}, Text: {r.text}'
|
||||
review_list = json.loads(r.text)
|
||||
reviewers.update([x['user']['login'] for x in review_list])
|
||||
paginate_request(f'https://api.github.com/repos/dmlc/xgboost/pulls/{pr_id}/commits',
|
||||
process_commit_list)
|
||||
paginate_request(f'https://api.github.com/repos/dmlc/xgboost/pulls/{pr_id}/reviews',
|
||||
process_review_list)
|
||||
paginate_request(f'https://api.github.com/repos/dmlc/xgboost/issues/{pr_id}/comments',
|
||||
process_comment_list)
|
||||
|
||||
r = requests.get(f'https://api.github.com/repos/dmlc/xgboost/issues/{pr_id}/comments', auth=(username, password))
|
||||
assert r.status_code == requests.codes.ok, f'Code: {r.status_code}, Text: {r.text}'
|
||||
comment_list = json.loads(r.text)
|
||||
reviewers.update([x['user']['login'] for x in comment_list])
|
||||
|
||||
print('Contributors:', end='')
|
||||
print('Contributors: ', end='')
|
||||
for x in sorted(contributors):
|
||||
r = requests.get(f'https://api.github.com/users/{x}', auth=(username, password))
|
||||
assert r.status_code == requests.codes.ok, f'Code: {r.status_code}, Text: {r.text}'
|
||||
@@ -52,7 +62,7 @@ for x in sorted(contributors):
|
||||
else:
|
||||
print(f"{user_info['name']} (@{x}), ", end='')
|
||||
|
||||
print('Reviewers:', end='')
|
||||
print('\nReviewers: ', end='')
|
||||
for x in sorted(reviewers):
|
||||
r = requests.get(f'https://api.github.com/users/{x}', auth=(username, password))
|
||||
assert r.status_code == requests.codes.ok, f'Code: {r.status_code}, Text: {r.text}'
|
||||
@@ -61,3 +71,4 @@ for x in sorted(reviewers):
|
||||
print(f"@{x}, ", end='')
|
||||
else:
|
||||
print(f"{user_info['name']} (@{x}), ", end='')
|
||||
print('')
|
||||
|
||||
Reference in New Issue
Block a user