mirror of
https://github.com/huggingface/diffusers.git
synced 2026-01-27 17:22:53 +03:00
[Bot] FIX stale.py uses timezone-aware datetime (#5396)
reflect stalebot change from https://github.com/huggingface/peft/pull/1016/
This commit is contained in:
@@ -17,6 +17,7 @@ https://github.com/allenai/allennlp.
|
||||
"""
|
||||
import os
|
||||
from datetime import datetime as dt
|
||||
from datetime import timezone
|
||||
|
||||
from github import Github
|
||||
|
||||
@@ -43,8 +44,8 @@ def main():
|
||||
if (
|
||||
last_comment is not None
|
||||
and last_comment.user.login == "github-actions[bot]"
|
||||
and (dt.utcnow() - issue.updated_at).days > 7
|
||||
and (dt.utcnow() - issue.created_at).days >= 30
|
||||
and (dt.now(timezone.utc) - issue.updated_at).days > 7
|
||||
and (dt.now(timezone.utc) - issue.created_at).days >= 30
|
||||
and not any(label.name.lower() in LABELS_TO_EXEMPT for label in issue.get_labels())
|
||||
):
|
||||
# Closes the issue after 7 days of inactivity since the Stalebot notification.
|
||||
@@ -58,8 +59,8 @@ def main():
|
||||
issue.edit(state="open")
|
||||
issue.remove_from_labels("stale")
|
||||
elif (
|
||||
(dt.utcnow() - issue.updated_at).days > 23
|
||||
and (dt.utcnow() - issue.created_at).days >= 30
|
||||
(dt.now(timezone.utc) - issue.updated_at).days > 23
|
||||
and (dt.now(timezone.utc) - issue.created_at).days >= 30
|
||||
and not any(label.name.lower() in LABELS_TO_EXEMPT for label in issue.get_labels())
|
||||
):
|
||||
# Post a Stalebot notification after 23 days of inactivity.
|
||||
|
||||
Reference in New Issue
Block a user