Remove functionality and references to 'remove_previous_review_comment' option

This commit is contained in:
mrT23
2024-03-03 11:24:30 +02:00
parent 5880221d00
commit f1bd67b7e9
4 changed files with 4 additions and 14 deletions

View File

@ -212,14 +212,10 @@ The configuration parameter `push_commands` defines the list of tools that will
handle_push_trigger = true
push_commands = [
"/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true",
"/review -i --pr_reviewer.remove_previous_review_comment=true",
"/review --pr_reviewer.num_code_suggestions=0",
]
```
This means that when new code is pushed to the PR, the PR-Agent will run the `describe` and incremental `review` tools.
For the `describe` tool, the `add_original_user_description` and `keep_original_user_title` parameters will be set to true.
For the `review` tool, it will run in incremental mode, and the `remove_previous_review_comment` parameter will be set to true.
Much like the configurations for `pr_commands`, you can override the default tool parameters by uploading a local configuration file to the root of your repo.
This means that when new code is pushed to the PR, the PR-Agent will run the `describe` and `review` tools, with the specified parameters.
### Working with GitHub Action
`GitHub Action` is a different way to trigger PR-Agent tools, and uses a different configuration mechanism than `GitHub App`.

View File

@ -77,7 +77,6 @@ For example, if `minimal_commits_for_incremental_review=2` and `minimal_minutes_
When `require_all_thresholds_for_incremental_review=true` the incremental review __will not__ run, because only 1 out of 2 conditions were met (we have enough commits but the last review is too recent),
but when `require_all_thresholds_for_incremental_review=false` the incremental review __will__ run, because one condition is enough (we have 3 commits which is more than the configured 2).
Default is false - the tool will run as long as at least once conditions is met.
- `remove_previous_review_comment`: if set to true, the tool will remove the previous review comment before adding a new one. Default is false.
### PR Reflection
By invoking:

View File

@ -34,7 +34,6 @@ num_code_suggestions=4
inline_code_comments = false
ask_and_reflect=false
#automatic_review=true
remove_previous_review_comment=false
persistent_comment=true
extra_instructions = ""
# review labels

View File

@ -119,8 +119,6 @@ class PRReviewer:
get_logger().debug(f"PR output", artifact=pr_review)
if get_settings().config.publish_output:
previous_review_comment = self._get_previous_review_comment()
# publish the review
if get_settings().pr_reviewer.persistent_comment and not self.incremental.is_incremental:
self.git_provider.publish_persistent_comment(pr_review,
@ -130,8 +128,6 @@ class PRReviewer:
self.git_provider.publish_comment(pr_review)
self.git_provider.remove_initial_comment()
if previous_review_comment:
self._remove_previous_review_comment(previous_review_comment)
if get_settings().pr_reviewer.inline_code_comments:
self._publish_inline_code_comments()
except Exception as e:
@ -295,7 +291,7 @@ class PRReviewer:
Get the previous review comment if it exists.
"""
try:
if get_settings().pr_reviewer.remove_previous_review_comment and hasattr(self.git_provider, "get_previous_review"):
if hasattr(self.git_provider, "get_previous_review"):
return self.git_provider.get_previous_review(
full=not self.incremental.is_incremental,
incremental=self.incremental.is_incremental,
@ -308,7 +304,7 @@ class PRReviewer:
Remove the previous review comment if it exists.
"""
try:
if get_settings().pr_reviewer.remove_previous_review_comment and comment:
if comment:
self.git_provider.remove_comment(comment)
except Exception as e:
get_logger().exception(f"Failed to remove previous review comment, error: {e}")