diff --git a/pr_agent/git_providers/gitea_provider.py b/pr_agent/git_providers/gitea_provider.py index b6983f81..1d671558 100644 --- a/pr_agent/git_providers/gitea_provider.py +++ b/pr_agent/git_providers/gitea_provider.py @@ -122,22 +122,31 @@ class GiteaProvider(GitProvider): def publish_inline_comments(self, comments: list[dict]): for comment in comments: - self.publish_inline_comment( - comment['body'], - comment['relevant_file'], - comment['relevant_line_in_file'], - comment.get('original_suggestion') - ) + try: + self.publish_inline_comment( + comment['body'], + comment['relevant_file'], + comment['relevant_line_in_file'], + 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: + overall_success = True for suggestion in code_suggestions: - self.publish_inline_comment( - suggestion['body'], - suggestion['relevant_file'], - suggestion['relevant_line_in_file'], - suggestion.get('original_suggestion') - ) - return True + try: + self.publish_inline_comment( + suggestion['body'], + suggestion['relevant_file'], + suggestion['relevant_line_in_file'], + suggestion.get('original_suggestion') + ) + 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): url = f"{self.gitea_url}/api/v1/repos/{self.owner}/{self.repo}/issues/{self.pr_num}/labels" diff --git a/tests/e2e_tests/test_gitea_app.py b/tests/e2e_tests/test_gitea_app.py index 7114f527..3a209975 100644 --- a/tests/e2e_tests/test_gitea_app.py +++ b/tests/e2e_tests/test_gitea_app.py @@ -126,7 +126,7 @@ def test_e2e_run_gitea_app(): response.raise_for_status() comments = response.json() - if len(comments) >= 5: # заголовок, 3 предложения, 1 ревью + if len(comments) >= 5: valid_review = False for comment in comments: if comment['body'].startswith('## PR Reviewer Guide 🔍'): @@ -152,7 +152,6 @@ def test_e2e_run_gitea_app(): ) response.raise_for_status() - # Удаляем ветку response = requests.delete( f"{gitea_url}/api/v1/repos/{owner}/{repo_name}/git/refs/heads/{new_branch}", headers=headers