|
1 | | -from datetime import datetime, timedelta |
| 1 | +from datetime import datetime, timedelta, timezone |
2 | 2 | import logging |
3 | 3 | from pathlib import Path |
4 | 4 | from typing import Dict, List, Optional, Set |
|
7 | 7 | from github.Issue import Issue |
8 | 8 | from github.IssueComment import IssueComment |
9 | 9 | from github.IssueEvent import IssueEvent |
10 | | -from pydantic import BaseModel, BaseSettings, SecretStr, validator |
| 10 | +from pydantic import BaseModel, SecretStr, validator |
| 11 | +from pydantic_settings import BaseSettings |
11 | 12 |
|
12 | 13 |
|
13 | 14 | class KeywordMeta(BaseModel): |
@@ -92,11 +93,12 @@ def process_issue(*, issue: Issue, settings: Settings) -> None: |
92 | 93 | events = list(issue.get_events()) |
93 | 94 | labeled_events = get_labeled_events(events) |
94 | 95 | last_comment = get_last_comment(issue) |
| 96 | + now = datetime.now(timezone.utc) |
95 | 97 | for keyword, keyword_meta in settings.input_config.items(): |
96 | 98 | # Check closable delay, if enough time passed and the issue could be closed |
97 | 99 | closable_delay = ( |
98 | 100 | last_comment is None |
99 | | - or (datetime.utcnow() - keyword_meta.delay) > last_comment.created_at |
| 101 | + or (now - keyword_meta.delay) > last_comment.created_at |
100 | 102 | ) |
101 | 103 | # Check label, optionally removing it if there's a comment after adding it |
102 | 104 | if keyword in label_strs: |
|
0 commit comments