Skip to content

Commit 070d4e0

Browse files
committed
fix(check): utcnow deprecation warning
1 parent 05f94f9 commit 070d4e0

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

scripts/checker.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import re
33
import json
44
import requests
5-
from datetime import datetime
5+
from datetime import datetime, timezone
6+
67

78
github_headers = {'Authorization': 'token %s' % os.environ.get("GITHUB_TOKEN")}
89

@@ -502,7 +503,8 @@ def check_github_version(stack):
502503
for tag in response.json()["data"]["repository"]["refs"]["edges"]:
503504
if "tagger" in tag["node"]["target"]:
504505
date = datetime.strptime(
505-
tag["node"]["target"]["tagger"]["date"][:19], "%Y-%m-%dT%H:%M:%S")
506+
tag["node"]["target"]["tagger"]["date"][:19], "%Y-%m-%dT%H:%M:%S"
507+
).astimezone(timezone.utc)
506508
else:
507509
date = datetime.strptime(
508510
requests.get(
@@ -511,9 +513,9 @@ def check_github_version(stack):
511513
), headers=github_headers
512514
).json()["commit"]["author"]["date"][:19],
513515
"%Y-%m-%dT%H:%M:%S"
514-
)
516+
).astimezone(timezone.utc)
515517
if re.match(info["match"], tag["node"]["name"]):
516-
if (datetime.utcnow() - date).days <= 7:
518+
if (datetime.now(timezone.utc) - date).days <= 7:
517519
create_github_issue(stack, tag["node"]["name"])
518520
else:
519521
break

0 commit comments

Comments
 (0)