Skip to content

Commit

Permalink
fixe repo name
Browse files Browse the repository at this point in the history
  • Loading branch information
rodja committed Dec 31, 2023
1 parent bdb86ab commit 5cb8534
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fetch_milestone.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

import requests

BASE_URL = 'https://api.github.com/repos/zauberzeug/livesync'
REPOSITORY = 'zauberzeug/livesync'
BASE_URL = f'https://api.github.com/repos/{REPOSITORY}'

parser = argparse.ArgumentParser(description='Fetch the content of a milestone from a GitHub repo.')
parser.add_argument('milestone_title', help='Title of the milestone to fetch.')
args = parser.parse_args()
milestone_title: str = args.milestone_title

milestones = requests.get(f'{BASE_URL}/milestones', timeout=5).json()
print(milestones)
matching_milestones = [milestone for milestone in milestones if milestone['title'] == milestone_title]
if not matching_milestones:
print(f'Milestone "{milestone_title}" not found!')
Expand All @@ -31,7 +33,7 @@
user: str = issue['user']['login']
body: str = issue['body']
labels: list[str] = [label['name'] for label in issue['labels']]
number_patterns = [r'#(\d+)', r'https://github.com/zauberzeug/nicegui/(?:issues|discussions|pulls)/(\d+)']
number_patterns = [r'#(\d+)', rf'https://github.com/{REPOSITORY}/(?: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))
note = f'{title.strip()} ({numbers_str} by @{user})'
Expand Down

0 comments on commit 5cb8534

Please sign in to comment.