Skip to content

Commit

Permalink
Fix datetime logic
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoWilken committed Nov 29, 2023
1 parent cc7e0f5 commit d0a5ab1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions list-branch-pr
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import sys

from argparse import ArgumentParser
from collections import defaultdict
from datetime import datetime
from datetime import datetime, timezone

from gql import Client, gql
from gql.transport.requests import RequestsHTTPTransport
Expand Down Expand Up @@ -258,11 +258,11 @@ def main(args):
# pr["updated_at"] can apparently be None sometimes, which breaks
# sorting, so default to the empty string if so.
for pull in sorted(prs, key=lambda pr: pr["updated_at"] or ""):
last_push_timestamp = \
int(datetime.fromisoformat(pull["updated_at"]).timestamp) \
if pull["updated_at"] else int(datetime.utcnow().timestamp)
updated_at = pull["updated_at"]
last_push = datetime.fromisoformat(updated_at) \
if updated_at else datetime.now(timezone.utc)
print(group, pull["number"], pull["sha"], pull["build_config"],
last_push_timestamp, sep="\t")
int(last_push.timestamp()), sep="\t")

if grouped["untested"]:
# If there are untested PRs waiting, build all of them first.
Expand Down

0 comments on commit d0a5ab1

Please sign in to comment.