Skip to content

Commit

Permalink
refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
mrT23 committed Jul 5, 2024
1 parent 78bcb72 commit 7fc4140
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pr_agent/tools/pr_code_suggestions.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ async def run(self):
update_header=True,
name="suggestions",
final_update_message = final_update_message,
max_previous_comments = get_settings().pr_code_suggestions.max_history_len)
if self.progress_response:
self.progress_response.delete()
max_previous_comments = get_settings().pr_code_suggestions.max_history_len,
progress_response = self.progress_response)
else:

if self.progress_response:
Expand Down Expand Up @@ -174,7 +173,8 @@ def publish_persistent_comment_with_history(self, pr_comment: str,
update_header: bool = True,
name='review',
final_update_message=True,
max_previous_comments=4):
max_previous_comments=4,
progress_response=None):
history_header = f"#### Previous suggestions\n"
last_commit_num = self.git_provider.get_latest_commit_url().split('/')[-1][:7]
latest_suggestion_header = f"Latest suggestions up to {last_commit_num}"
Expand Down Expand Up @@ -242,8 +242,11 @@ def publish_persistent_comment_with_history(self, pr_comment: str,
pr_comment_updated += f"{prev_suggestion_table}\n"

get_logger().info(f"Persistent mode - updating comment {comment_url} to latest {name} message")

self.git_provider.edit_comment(comment, pr_comment_updated)
if progress_response: # publish to 'progress_response' comment, because it refreshes immediately
comment.delete()
self.git_provider.edit_comment(progress_response, pr_comment_updated)
else:
self.git_provider.edit_comment(comment, pr_comment_updated)
return
except Exception as e:
get_logger().exception(f"Failed to update persistent review, error: {e}")
Expand Down

0 comments on commit 7fc4140

Please sign in to comment.