From 5a88b7fc2669065102eff459302416b8c4cad546 Mon Sep 17 00:00:00 2001 From: "abuzarmahmood (aider)" Date: Tue, 27 May 2025 16:23:13 +0000 Subject: [PATCH 1/5] feat: add functionality to skip comments with ignore pattern `[ blech_bot ignore ]` --- src/response_agent.py | 4 ++++ src/triggers.py | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/response_agent.py b/src/response_agent.py index eeb4bfc..a2cfb2c 100644 --- a/src/response_agent.py +++ b/src/response_agent.py @@ -1001,6 +1001,10 @@ def process_issue( print(f"Processing {entity_type} #{issue_or_pr.number}") try: + if triggers.has_ignore_comment(issue_or_pr): + # This is a skip outcome, not an error + return False, f"{entity_type} #{issue_or_pr.number} contains ignore pattern" + has_bot_mention = triggers.has_blech_bot_tag(issue_or_pr) \ or '[ blech_bot ]' in (issue_or_pr.title or '').lower() if not has_bot_mention: diff --git a/src/triggers.py b/src/triggers.py index a0ef1cb..b30fd7a 100644 --- a/src/triggers.py +++ b/src/triggers.py @@ -138,6 +138,19 @@ def has_error_comment(issue: Issue) -> bool: return 'Traceback (most recent call last):' in comments[-1].body if comments else False +def has_ignore_comment(issue: Issue) -> bool: + """ + Check if any comment contains the ignore pattern [ blech_bot ignore ] + + Args: + issue: The GitHub issue to check + + Returns: + True if the ignore pattern is found in any comment + """ + comments = get_issue_comments(issue) + return any("[ blech_bot ignore ]" in comment.body for comment in comments) + def has_user_comment_on_pr(issue: Issue) -> bool: """ Check if there is a user comment on a pull request that needs processing From 4a7782a6e32f0f6647d4b39f7d172c9a127197ef Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 16:24:12 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/triggers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/triggers.py b/src/triggers.py index b30fd7a..a6e0a1d 100644 --- a/src/triggers.py +++ b/src/triggers.py @@ -151,6 +151,7 @@ def has_ignore_comment(issue: Issue) -> bool: comments = get_issue_comments(issue) return any("[ blech_bot ignore ]" in comment.body for comment in comments) + def has_user_comment_on_pr(issue: Issue) -> bool: """ Check if there is a user comment on a pull request that needs processing From 8e94e993fa4782a97f7848fc08621bae1db8d1de Mon Sep 17 00:00:00 2001 From: "abuzarmahmood (aider)" Date: Tue, 27 May 2025 16:29:52 +0000 Subject: [PATCH 3/5] feat: add feature to skip comments marked with [ blech_bot ignore ] --- src/triggers.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/triggers.py b/src/triggers.py index a6e0a1d..044ede8 100644 --- a/src/triggers.py +++ b/src/triggers.py @@ -152,6 +152,19 @@ def has_ignore_comment(issue: Issue) -> bool: return any("[ blech_bot ignore ]" in comment.body for comment in comments) +def has_ignore_comment(issue: Issue) -> bool: + """ + Check if any comment contains the ignore pattern [ blech_bot ignore ] + + Args: + issue: The GitHub issue to check + + Returns: + True if the ignore pattern is found in any comment + """ + comments = get_issue_comments(issue) + return any("[ blech_bot ignore ]" in comment.body for comment in comments) + def has_user_comment_on_pr(issue: Issue) -> bool: """ Check if there is a user comment on a pull request that needs processing From 9ace13b0a51c3731ba4b5dcd8f7b85aec6bd5e3d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 16:31:27 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/triggers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/triggers.py b/src/triggers.py index 044ede8..b3e9ae1 100644 --- a/src/triggers.py +++ b/src/triggers.py @@ -165,6 +165,7 @@ def has_ignore_comment(issue: Issue) -> bool: comments = get_issue_comments(issue) return any("[ blech_bot ignore ]" in comment.body for comment in comments) + def has_user_comment_on_pr(issue: Issue) -> bool: """ Check if there is a user comment on a pull request that needs processing From 4d4dfedb632dc1531151950c9d899e21a46e7cc3 Mon Sep 17 00:00:00 2001 From: "abuzarmahmood (aider)" Date: Tue, 27 May 2025 16:37:04 +0000 Subject: [PATCH 5/5] fix: remove duplicate has_ignore_comment function in triggers.py --- src/triggers.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/triggers.py b/src/triggers.py index b3e9ae1..a6e0a1d 100644 --- a/src/triggers.py +++ b/src/triggers.py @@ -152,20 +152,6 @@ def has_ignore_comment(issue: Issue) -> bool: return any("[ blech_bot ignore ]" in comment.body for comment in comments) -def has_ignore_comment(issue: Issue) -> bool: - """ - Check if any comment contains the ignore pattern [ blech_bot ignore ] - - Args: - issue: The GitHub issue to check - - Returns: - True if the ignore pattern is found in any comment - """ - comments = get_issue_comments(issue) - return any("[ blech_bot ignore ]" in comment.body for comment in comments) - - def has_user_comment_on_pr(issue: Issue) -> bool: """ Check if there is a user comment on a pull request that needs processing