persistent

s
This commit is contained in:
mrT23
2023-11-08 19:27:16 +02:00
parent f9c832d6cb
commit 14610d5375
8 changed files with 39 additions and 3 deletions

View File

@ -154,10 +154,20 @@ class GithubProvider(GitProvider):
def publish_description(self, pr_title: str, pr_body: str):
self.pr.edit(title=pr_title, body=pr_body)
def publish_persistent_review(self, pr_comment: str):
prev_comments = list(self.pr.get_issue_comments())
for comment in prev_comments:
if comment.body.startswith('## PR Analysis'):
pr_comment_updated = pr_comment.replace('## PR Analysis\n', '## PR Analysis (updated)\n')
response = comment.edit(pr_comment_updated)
return
self.publish_comment(pr_comment)
def publish_comment(self, pr_comment: str, is_temporary: bool = False):
if is_temporary and not get_settings().config.publish_output_progress:
get_logger().debug(f"Skipping publish_comment for temporary comment: {pr_comment}")
return
response = self.pr.create_issue_comment(pr_comment)
if hasattr(response, "user") and hasattr(response.user, "login"):
self.github_user_id = response.user.login