Skip to content

Commit

Permalink
Add .py file extension to generate-release-notes and format flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
rdimaio authored and bari12 committed Mar 21, 2024
1 parent bc8fae0 commit 49aba7d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tools/generate-release-notes → tools/generate-release-notes.py
Expand Up @@ -38,6 +38,7 @@
else:
milestone_title = arg


def format_issue(issue, doc=False):
if not doc:
if issue['component']:
Expand All @@ -57,6 +58,7 @@ def load_milestones(github_token, page=1):
params={'state': 'all', 'page': page, 'per_page': '100'})
return json.loads(r.text)


def get_issue_component_type(issue):
component = None
type_ = 'enhancement'
Expand All @@ -72,6 +74,7 @@ def get_issue_component_type(issue):
type_ = 'feature'
return component, type_


def print_issues(issues, section_title):
if not issues:
return
Expand Down Expand Up @@ -118,6 +121,7 @@ def print_issues(issues, section_title):
for issue in bugs:
print(format_issue(issue, doc=True))


root_git_dir = subprocess.check_output('git rev-parse --show-toplevel', shell=True).decode("utf-8").rstrip()
# Load OAUTH token
try:
Expand Down Expand Up @@ -152,21 +156,21 @@ def print_issues(issues, section_title):
# If --backport is specified, we additionally need to scan older issues
if option_backport:
r = requests.get(url='https://api.github.com/repos/rucio/rucio/issues',
headers={'Authorization': 'token %s' % github_token},
params={'labels': 'backport', 'state': 'closed', 'per_page': 100})
headers={'Authorization': 'token %s' % github_token},
params={'labels': 'backport', 'state': 'closed', 'per_page': 100})
for issue in json.loads(r.text):
# Load the comments
r = requests.get(url=issue['comments_url'],
headers={'Authorization': 'token %s' % github_token},
params={'per_page': 100})
headers={'Authorization': 'token %s' % github_token},
params={'per_page': 100})
# Iterate comments
for comment in json.loads(r.text):
if 'backport %s' % milestone_title in comment['body'].lower():
component, type_ = get_issue_component_type(issue)
issues.append({'component': component,
'type': type_,
'number': issue['number'],
'title': issue['title']})
'type': type_,
'number': issue['number'],
'title': issue['title']})

print_issues([issue for issue in issues if issue['component'] not in ['Clients', 'WebUI']], 'General')
print_issues([issue for issue in issues if issue['component'] in ['Clients']], 'Clients')
Expand Down

0 comments on commit 49aba7d

Please sign in to comment.