From 28eebf158af97d70abce606d6717adb6700e06c1 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Tue, 1 Apr 2025 09:19:52 +0200 Subject: [PATCH] some users have been deleted since, so the user attribute of the comment is None --- pull_requests.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pull_requests.py b/pull_requests.py index 63454d0..ce389d4 100644 --- a/pull_requests.py +++ b/pull_requests.py @@ -55,11 +55,13 @@ def is_pull_good(pull: PullRequest, verbose: bool = False) -> bool: if comments.totalCount == 2: comment_1, comment_2 = sorted(comments, key=lambda c: c.created_at) + if comment_2.user is not None: + return False # we can't if the second is from the author, so we discard the PR - is_reply = comment_2.in_reply_to_id == comment_1.id - is_from_author = comment_2.user.id == pull.user.id - - if not (is_reply and is_from_author): + if comment_1.user is not None and not ( + comment_2.in_reply_to_id == comment_1.id # is reply + and comment_2.user.id == pull.user.id # from the author of the PR + ): return False return has_only_1_comment(pull.get_commits(), pull.get_review_comments(), verbose=verbose)