mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 21:00:40 +08:00
#1657 review fix 2
This commit is contained in:
@ -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:
|
||||||
self.publish_inline_comment(
|
try:
|
||||||
comment['body'],
|
self.publish_inline_comment(
|
||||||
comment['relevant_file'],
|
comment['body'],
|
||||||
comment['relevant_line_in_file'],
|
comment['relevant_file'],
|
||||||
comment.get('original_suggestion')
|
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:
|
def publish_code_suggestions(self, code_suggestions: list) -> bool:
|
||||||
|
overall_success = True
|
||||||
for suggestion in code_suggestions:
|
for suggestion in code_suggestions:
|
||||||
self.publish_inline_comment(
|
try:
|
||||||
suggestion['body'],
|
self.publish_inline_comment(
|
||||||
suggestion['relevant_file'],
|
suggestion['body'],
|
||||||
suggestion['relevant_line_in_file'],
|
suggestion['relevant_file'],
|
||||||
suggestion.get('original_suggestion')
|
suggestion['relevant_line_in_file'],
|
||||||
)
|
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"
|
||||||
|
@ -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
|
||||||
|
Reference in New Issue
Block a user