From cf4d007737ac3467ed838a32a6db4d19105974e1 Mon Sep 17 00:00:00 2001 From: Zohar Meir <33152084+zmeir@users.noreply.github.com> Date: Tue, 31 Oct 2023 00:00:48 +0200 Subject: [PATCH] Fix commands list for push trigger --- pr_agent/servers/github_app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pr_agent/servers/github_app.py b/pr_agent/servers/github_app.py index 7b33fdc2..36cc3e88 100644 --- a/pr_agent/servers/github_app.py +++ b/pr_agent/servers/github_app.py @@ -122,7 +122,7 @@ async def handle_request(body: Dict[str, Any], event: str): if body.get("requested_reviewer", {}).get("login", "") != bot_user: return {} get_logger().info(f"Performing review for {api_url=} because of {event=} and {action=}") - await _perform_commands(agent, body, api_url, log_context) + await _perform_commands("pr_commands", agent, body, api_url, log_context) # handle pull_request event with synchronize action - "push trigger" for new commits elif event == 'pull_request' and action == 'synchronize' and get_settings().github_app.handle_push_trigger: @@ -174,7 +174,7 @@ async def handle_request(body: Dict[str, Any], event: str): get_logger().info(f"Skipping incremental review because there was no initial review for {api_url=} yet") return {} get_logger().info(f"Performing incremental review for {api_url=} because of {event=} and {action=}") - await _perform_commands(agent, body, api_url, log_context) + await _perform_commands("push_commands", agent, body, api_url, log_context) finally: # release the waiting task block @@ -203,9 +203,9 @@ def _check_pull_request_event(action: str, body: dict, log_context: dict, bot_us return pull_request, api_url -async def _perform_commands(agent: PRAgent, body: dict, api_url: str, log_context: dict): +async def _perform_commands(commands_conf: str, agent: PRAgent, body: dict, api_url: str, log_context: dict): apply_repo_settings(api_url) - commands = get_settings().github_app.pr_commands + commands = get_settings().get(f"github_app.{commands_conf}") for command in commands: split_command = command.split(" ") command = split_command[0]