Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/response_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import os

from src.git_utils import (
get_issue_comments,
get_github_client,
get_repository,
write_issue_response,
Expand Down Expand Up @@ -102,6 +103,19 @@ 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
Expand All @@ -120,7 +134,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))

Expand Down
2 changes: 2 additions & 0 deletions src/triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)


Expand Down
Loading