From f23328e07bfcb5d92c3c20cf1cc64e1362b4d88d Mon Sep 17 00:00:00 2001 From: Peter Chang Date: Fri, 9 Feb 2024 09:23:47 +0000 Subject: [PATCH] Fix timestamp parsing from updated pygithub to 2.1.0+ Improve milestone logging --- utils/create_release_notes.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/utils/create_release_notes.py b/utils/create_release_notes.py index 77a4d2c3b6..3138e5bc46 100755 --- a/utils/create_release_notes.py +++ b/utils/create_release_notes.py @@ -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}") @@ -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 = {