Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change pull requests dates to when they are closed #1349

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions utils/create_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,9 @@ def get_release_info(token, base_tag_name, head_branch_name, milestone_name):
# t.commit == commit
# t.commit.last_modified != commit.last_modified
commit = repo.get_commit(t.commit.sha)
dt = str2time(commit.last_modified)
dt = commit.last_modified_datetime
earliest = min(dt, earliest or dt)

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

# fmt: off
Expand Down Expand Up @@ -197,18 +196,6 @@ def parse_command_line():
return parser.parse_args()


def str2time(time_string):
"""convert date/time string to datetime object

input string example: ``Tue, 20 Dec 2016 17:35:40 GMT``
"""
if time_string is None:
msg = f"need valid date/time string, not: {time_string}"
logger.error(msg)
raise ValueError(msg)
return datetime.datetime.strptime(time_string, "%a, %d %b %Y %H:%M:%S %Z")


def report(title, repo, milestone, tags, pulls, issues, commits):
print(f"## {title}")
print("")
Expand All @@ -234,7 +221,7 @@ def report(title, repo, milestone, tags, pulls, issues, commits):
print("-" * 5, " | ", "-" * 5, " | ", "-" * 5)
for k, tag in sorted(tags.items()):
commit = repo.get_commit(tag.commit.sha)
when = str2time(commit.last_modified).strftime("%Y-%m-%d")
when = commit.last_modified_datetime.strftime("%Y-%m-%d")
print(f"[{tag.commit.sha[:7]}]({tag.commit.html_url}) | {when} | {k}")
print("")
print("### Pull Requests")
Expand All @@ -246,7 +233,7 @@ def report(title, repo, milestone, tags, pulls, issues, commits):
print("-" * 5, " | ", "-" * 5, " | ", "-" * 5, " | ", "-" * 5)
for k, pull in sorted(pulls.items()):
state = {True: "merged", False: "closed"}[pull.merged]
when = str2time(pull.last_modified).strftime("%Y-%m-%d")
when = pull.closed_at.strftime("%Y-%m-%d")
# fmt: off
print(
f"[#{pull.number}]({pull.html_url})"
Expand Down
Loading