#1657 review fix 2

This commit is contained in:
Nikolay Gribanov
2025-05-16 20:27:01 +03:00
parent 12b1fe23da
commit d67d07acc7
2 changed files with 23 additions and 15 deletions

View File

@ -122,22 +122,31 @@ class GiteaProvider(GitProvider):
def publish_inline_comments(self, comments: list[dict]): def publish_inline_comments(self, comments: list[dict]):
for comment in comments: for comment in comments:
try:
self.publish_inline_comment( self.publish_inline_comment(
comment['body'], comment['body'],
comment['relevant_file'], comment['relevant_file'],
comment['relevant_line_in_file'], comment['relevant_line_in_file'],
comment.get('original_suggestion') comment.get('original_suggestion')
) )
except Exception as e:
get_logger().error(f"Failed to publish inline comment on {comment.get('relevant_file')}: {e}")
def publish_code_suggestions(self, code_suggestions: list) -> bool: def publish_code_suggestions(self, code_suggestions: list) -> bool:
overall_success = True
for suggestion in code_suggestions: for suggestion in code_suggestions:
try:
self.publish_inline_comment( self.publish_inline_comment(
suggestion['body'], suggestion['body'],
suggestion['relevant_file'], suggestion['relevant_file'],
suggestion['relevant_line_in_file'], suggestion['relevant_line_in_file'],
suggestion.get('original_suggestion') suggestion.get('original_suggestion')
) )
return True except Exception as e:
overall_success = False
get_logger().error(
f"Failed to publish code suggestion on {suggestion.get('relevant_file')}: {e}")
return overall_success
def publish_labels(self, labels): def publish_labels(self, labels):
url = f"{self.gitea_url}/api/v1/repos/{self.owner}/{self.repo}/issues/{self.pr_num}/labels" url = f"{self.gitea_url}/api/v1/repos/{self.owner}/{self.repo}/issues/{self.pr_num}/labels"

View File

@ -126,7 +126,7 @@ def test_e2e_run_gitea_app():
response.raise_for_status() response.raise_for_status()
comments = response.json() comments = response.json()
if len(comments) >= 5: # заголовок, 3 предложения, 1 ревью if len(comments) >= 5:
valid_review = False valid_review = False
for comment in comments: for comment in comments:
if comment['body'].startswith('## PR Reviewer Guide 🔍'): if comment['body'].startswith('## PR Reviewer Guide 🔍'):
@ -152,7 +152,6 @@ def test_e2e_run_gitea_app():
) )
response.raise_for_status() response.raise_for_status()
# Удаляем ветку
response = requests.delete( response = requests.delete(
f"{gitea_url}/api/v1/repos/{owner}/{repo_name}/git/refs/heads/{new_branch}", f"{gitea_url}/api/v1/repos/{owner}/{repo_name}/git/refs/heads/{new_branch}",
headers=headers headers=headers