From 9ab5585c72866940fef7107eb304a428cbb56b6c Mon Sep 17 00:00:00 2001 From: "abuzarmahmood (aider)" Date: Tue, 6 May 2025 12:09:30 +0000 Subject: [PATCH 1/2] feat: implement comment filtering to exclude "Codecov Report" comments --- src/response_agent.py | 17 ++++++++++++++++- src/triggers.py | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/response_agent.py b/src/response_agent.py index eeb4bfc..50fab56 100644 --- a/src/response_agent.py +++ b/src/response_agent.py @@ -25,6 +25,7 @@ import os from src.git_utils import ( + get_issue_comments, get_github_client, get_repository, write_issue_response, @@ -102,6 +103,18 @@ def tab_print(x): print('\t' + str(x)) +def filter_comments(comments: List) -> List: + """ + Filter out comments containing "Codecov Report". + + Args: + comments: List of comments to filter. + + Returns: + Filtered list of comments. + """ + return [comment for comment in comments if "Codecov Report" not in comment.body] + def extract_urls_from_issue(issue: Issue) -> List[str]: """ Extract URLs from issue body and comments @@ -120,7 +133,9 @@ def extract_urls_from_issue(issue: Issue) -> List[str]: urls.extend(extractor.find_urls(issue_body)) # Extract from comments - for comment in get_issue_comments(issue): + comments = get_issue_comments(issue) + comments = filter_comments(comments) + for comment in comments: comment_body = comment.body or "" urls.extend(extractor.find_urls(comment_body)) diff --git a/src/triggers.py b/src/triggers.py index a0ef1cb..2606b64 100644 --- a/src/triggers.py +++ b/src/triggers.py @@ -6,6 +6,7 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # noqa: E501 from github import Issue from src.git_utils import get_issue_comments, has_linked_pr, get_linked_pr +from src.response_agent import filter_comments def has_blech_bot_tag(issue: Issue) -> bool: @@ -32,6 +33,7 @@ def has_generate_edit_command_trigger(issue: Issue) -> bool: True if the trigger phrase is found in any comment """ comments = get_issue_comments(issue) + comments = filter_comments(comments) return any("[ generate_edit_command ]" in comment.body for comment in comments) From e4ef51ee321a018b02e9cade6d84eda35c0b90a9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 12:11:08 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/response_agent.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/response_agent.py b/src/response_agent.py index 50fab56..a117014 100644 --- a/src/response_agent.py +++ b/src/response_agent.py @@ -115,6 +115,7 @@ def filter_comments(comments: List) -> List: """ return [comment for comment in comments if "Codecov Report" not in comment.body] + def extract_urls_from_issue(issue: Issue) -> List[str]: """ Extract URLs from issue body and comments