mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 21:00:40 +08:00
fixed bugs with incremental review
This commit is contained in:
@ -34,8 +34,10 @@ class GithubProvider(GitProvider):
|
|||||||
self.incremental = incremental
|
self.incremental = incremental
|
||||||
if pr_url and 'pull' in pr_url:
|
if pr_url and 'pull' in pr_url:
|
||||||
self.set_pr(pr_url)
|
self.set_pr(pr_url)
|
||||||
self.pr_commits = self.pr.get_commits()
|
self.pr_commits = list(self.pr.get_commits())
|
||||||
self.last_commit_id = list(self.pr_commits)[-1]
|
if self.incremental.is_incremental:
|
||||||
|
self.get_incremental_commits()
|
||||||
|
self.last_commit_id = self.pr_commits[-1]
|
||||||
self.pr_url = self.get_pr_url() # pr_url for github actions can be as api.github.com, so we need to get the url from the pr object
|
self.pr_url = self.get_pr_url() # pr_url for github actions can be as api.github.com, so we need to get the url from the pr object
|
||||||
else:
|
else:
|
||||||
self.pr_commits = None
|
self.pr_commits = None
|
||||||
@ -49,8 +51,6 @@ class GithubProvider(GitProvider):
|
|||||||
def set_pr(self, pr_url: str):
|
def set_pr(self, pr_url: str):
|
||||||
self.repo, self.pr_num = self._parse_pr_url(pr_url)
|
self.repo, self.pr_num = self._parse_pr_url(pr_url)
|
||||||
self.pr = self._get_pr()
|
self.pr = self._get_pr()
|
||||||
if self.incremental.is_incremental:
|
|
||||||
self.get_incremental_commits()
|
|
||||||
|
|
||||||
def get_incremental_commits(self):
|
def get_incremental_commits(self):
|
||||||
if not self.pr_commits:
|
if not self.pr_commits:
|
||||||
@ -88,7 +88,7 @@ class GithubProvider(GitProvider):
|
|||||||
self.comments = list(self.pr.get_issue_comments())
|
self.comments = list(self.pr.get_issue_comments())
|
||||||
prefixes = []
|
prefixes = []
|
||||||
if full:
|
if full:
|
||||||
prefixes.append("## PR Analysis")
|
prefixes.append("## PR Review")
|
||||||
if incremental:
|
if incremental:
|
||||||
prefixes.append("## Incremental PR Review")
|
prefixes.append("## Incremental PR Review")
|
||||||
for index in range(len(self.comments) - 1, -1, -1):
|
for index in range(len(self.comments) - 1, -1, -1):
|
||||||
|
@ -35,7 +35,6 @@ async def handle_github_webhooks(request: Request, response: Response):
|
|||||||
|
|
||||||
body = await get_body(request)
|
body = await get_body(request)
|
||||||
|
|
||||||
get_logger().debug(f'Request body:\n{body}')
|
|
||||||
installation_id = body.get("installation", {}).get("id")
|
installation_id = body.get("installation", {}).get("id")
|
||||||
context["installation_id"] = installation_id
|
context["installation_id"] = installation_id
|
||||||
context["settings"] = copy.deepcopy(global_settings)
|
context["settings"] = copy.deepcopy(global_settings)
|
||||||
@ -209,15 +208,18 @@ async def handle_request(body: Dict[str, Any], event: str):
|
|||||||
|
|
||||||
# handle comments on PRs
|
# handle comments on PRs
|
||||||
if action == 'created':
|
if action == 'created':
|
||||||
|
get_logger().info(f'Request body:\n{body}')
|
||||||
await handle_comments_on_pr(body, event, sender, action, log_context, agent)
|
await handle_comments_on_pr(body, event, sender, action, log_context, agent)
|
||||||
# handle new PRs
|
# handle new PRs
|
||||||
elif event == 'pull_request' and action != 'synchronize':
|
elif event == 'pull_request' and action != 'synchronize':
|
||||||
|
get_logger().info(f'Request body:\n{body}')
|
||||||
await handle_new_pr_opened(body, event, sender, action, log_context, agent)
|
await handle_new_pr_opened(body, event, sender, action, log_context, agent)
|
||||||
# handle pull_request event with synchronize action - "push trigger" for new commits
|
# handle pull_request event with synchronize action - "push trigger" for new commits
|
||||||
elif event == 'pull_request' and action == 'synchronize':
|
elif event == 'pull_request' and action == 'synchronize':
|
||||||
|
get_logger().info(f'Request body:\n{body}')
|
||||||
await handle_push_trigger_for_new_commits(body, event, sender, action, log_context, agent)
|
await handle_push_trigger_for_new_commits(body, event, sender, action, log_context, agent)
|
||||||
else:
|
else:
|
||||||
get_logger().info("event or action does not require handling")
|
get_logger().info(f"event {event=} action {action=} does not require any handling")
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,19 +150,7 @@ push_trigger_pending_tasks_backlog = true
|
|||||||
push_trigger_pending_tasks_ttl = 300
|
push_trigger_pending_tasks_ttl = 300
|
||||||
push_commands = [
|
push_commands = [
|
||||||
"/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true",
|
"/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true",
|
||||||
"""/auto_review -i \
|
"/review --pr_reviewer.num_code_suggestions=0",
|
||||||
--pr_reviewer.require_focused_review=false \
|
|
||||||
--pr_reviewer.require_score_review=false \
|
|
||||||
--pr_reviewer.require_tests_review=false \
|
|
||||||
--pr_reviewer.require_estimate_effort_to_review=false \
|
|
||||||
--pr_reviewer.num_code_suggestions=0 \
|
|
||||||
--pr_reviewer.inline_code_comments=false \
|
|
||||||
--pr_reviewer.remove_previous_review_comment=true \
|
|
||||||
--pr_reviewer.require_all_thresholds_for_incremental_review=false \
|
|
||||||
--pr_reviewer.minimal_commits_for_incremental_review=5 \
|
|
||||||
--pr_reviewer.minimal_minutes_for_incremental_review=30 \
|
|
||||||
--pr_reviewer.extra_instructions='' \
|
|
||||||
"""
|
|
||||||
]
|
]
|
||||||
ignore_pr_title = []
|
ignore_pr_title = []
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user