Skip to content

Commit

Permalink
print ticket numbers as links
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Nov 6, 2023
1 parent 18975f7 commit 6442720
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fetch_milestone.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
sys.exit(1)
milestone_number = matching_milestones[0]['number']


def link(number: int) -> str:
# https://stackoverflow.com/a/71309268/3419103
escape_mask = '\033]8;{};{}\033\\{}\033]8;;\033\\'
return escape_mask.format('', f'https://github.com/zauberzeug/nicegui/issues/{number}', f'#{number}')


issues = requests.get(f'{BASE_URL}/issues?milestone={milestone_number}&state=all', timeout=5).json()
notes: Dict[str, List[str]] = {
'New features and enhancements': [],
Expand All @@ -34,7 +41,7 @@
labels: list[str] = [label['name'] for label in issue['labels']]
number_patterns = [r'#(\d+)', r'https://github.com/zauberzeug/nicegui/(?:issues|discussions|pulls)/(\d+)']
numbers = [issue['number']] + [int(match) for pattern in number_patterns for match in re.findall(pattern, body)]
numbers_str = ', '.join(f'#{number}' for number in sorted(numbers))
numbers_str = ', '.join(link(number) for number in sorted(numbers))
note = f'{title.strip()} ({numbers_str} by @{user})'
if 'bug' in labels:
notes['Bugfixes'].append(note)
Expand Down

0 comments on commit 6442720

Please sign in to comment.