Skip to content

Commit

Permalink
Fix timestamp parsing from updated pygithub to 2.1.0+
Browse files Browse the repository at this point in the history
Improve milestone logging
  • Loading branch information
PeterC-DLS committed Feb 9, 2024
1 parent 8f5c7e8 commit 2b59fda
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions utils/create_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,23 @@ def get_release_info(token, base_tag_name, head_branch_name, milestone_name):
logger.debug(f"repo: {repo}")

# fmt: off
milestones = [
all_milestones = tuple(repo.get_milestones(state="all"))
matching_milestones = tuple(
m
for m in repo.get_milestones(state="all")
for m in all_milestones
if m.title == milestone_name
]
)
# fmt: on
if len(milestones) == 0:
msg = f"Could not find milestone: {milestone_name}"
if len(matching_milestones) == 0:
msg = f"Could not find milestone to match '{milestone_name}':"
for m in all_milestones:
msg += f"\n\t{m.title}"
logger.error(msg)
raise ValueError(msg)
milestone = milestones[0]
milestone = matching_milestones[0]
logger.debug(f"milestone: {milestone}")

logger.debug(f"compare: {base_tag_name} -> {head_branch_name}")
compare = repo.compare(base_tag_name, head_branch_name)
logger.debug(f"compare: {compare}")

Expand All @@ -126,7 +130,9 @@ def get_release_info(token, base_tag_name, head_branch_name, milestone_name):
commit = repo.get_commit(t.commit.sha)
dt = str2time(commit.last_modified)
earliest = min(dt, earliest or dt)
logger.debug(f"# tags: {len(tags)}")

earliest = earliest.astimezone(datetime.timezone.utc)
logger.debug(f"# tags: {len(tags)} {earliest}")

# fmt: off
pulls = {
Expand Down

0 comments on commit 2b59fda

Please sign in to comment.