diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index 0858afff..3601bfa0 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -90,9 +90,9 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool = True, increment } markdown_text = "" if not incremental_review: - markdown_text += f"{PrReviewTitle.REGULAR} ๐Ÿ”\n\n" + markdown_text += f"{PrReviewTitle.REGULAR.value} ๐Ÿ”\n\n" else: - markdown_text += f"{PrReviewTitle.INCREMENTAL} ๐Ÿ”\n\n" + markdown_text += f"{PrReviewTitle.INCREMENTAL.value} ๐Ÿ”\n\n" markdown_text += f"โฎ๏ธ Review for commits since previous PR-Agent review {incremental_review}.\n\n" if gfm_supported: markdown_text += "\n" diff --git a/pr_agent/git_providers/github_provider.py b/pr_agent/git_providers/github_provider.py index 1905f5cc..cb03981e 100644 --- a/pr_agent/git_providers/github_provider.py +++ b/pr_agent/git_providers/github_provider.py @@ -96,9 +96,9 @@ class GithubProvider(GitProvider): self.comments = list(self.pr.get_issue_comments()) prefixes = [] if full: - prefixes.append({PrReviewTitle.REGULAR}) + prefixes.append({PrReviewTitle.REGULAR.value}) if incremental: - prefixes.append({PrReviewTitle.INCREMENTAL}) + prefixes.append({PrReviewTitle.INCREMENTAL.value}) for index in range(len(self.comments) - 1, -1, -1): if any(self.comments[index].body.startswith(prefix) for prefix in prefixes): return self.comments[index] diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index 559a0f2e..f255badb 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -134,7 +134,7 @@ class PRReviewer: if get_settings().pr_reviewer.persistent_comment and not self.incremental.is_incremental: final_update_message = get_settings().pr_reviewer.final_update_message self.git_provider.publish_persistent_comment(pr_review, - initial_header=f"{PrReviewTitle.REGULAR} ๐Ÿ”", + initial_header=f"{PrReviewTitle.REGULAR.value} ๐Ÿ”", update_header=True, final_update_message=final_update_message, ) else: diff --git a/tests/unittest/test_convert_to_markdown.py b/tests/unittest/test_convert_to_markdown.py index 0cc91ee9..66b343b3 100644 --- a/tests/unittest/test_convert_to_markdown.py +++ b/tests/unittest/test_convert_to_markdown.py @@ -52,7 +52,7 @@ class TestConvertToMarkdown: 'suggestion': "Consider raising an exception or logging a warning when 'pr_url' attribute is not found. This can help in debugging issues related to the absence of 'pr_url' in instances where it's expected. [important]\n", 'relevant_line': '[return ""](https://github.com/Codium-ai/pr-agent-pro/pull/102/files#diff-52d45f12b836f77ed1aef86e972e65404634ea4e2a6083fb71a9b0f9bb9e062fR199)'}]} - expected_output = f'{PrReviewTitle.REGULAR} ๐Ÿ”\n\n
\n\n\n\n\n
โฑ๏ธ Estimated effort to review [1-5]\n1, because the changes are minimal and straightforward, focusing on a single functionality addition.\n\n\n
๐Ÿงช Relevant tests\nNo\n\n\n
โšก Possible issues\nNo\n\n\n
๐Ÿ”’ Security concerns\nNo\n\n
\n\n\n
Code feedback:\n\n
relevant filepr_agent/git_providers/git_provider.py\n
suggestion      \n\n\n\nConsider raising an exception or logging a warning when \'pr_url\' attribute is not found. This can help in debugging issues related to the absence of \'pr_url\' in instances where it\'s expected. [important]\n\n\n
relevant linereturn ""

\n\n
' + expected_output = f'{PrReviewTitle.REGULAR.value} ๐Ÿ”\n\n\n\n\n\n\n
โฑ๏ธ Estimated effort to review [1-5]\n1, because the changes are minimal and straightforward, focusing on a single functionality addition.\n\n\n
๐Ÿงช Relevant tests\nNo\n\n\n
โšก Possible issues\nNo\n\n\n
๐Ÿ”’ Security concerns\nNo\n\n
\n\n\n
Code feedback:\n\n
relevant filepr_agent/git_providers/git_provider.py\n
suggestion      \n\n\n\nConsider raising an exception or logging a warning when \'pr_url\' attribute is not found. This can help in debugging issues related to the absence of \'pr_url\' in instances where it\'s expected. [important]\n\n\n
relevant linereturn ""

\n\n
' assert convert_to_markdown(input_data).strip() == expected_output.strip()