From 80a793a2579dbed2d24d8ce4ebaa3b7af001d40a Mon Sep 17 00:00:00 2001 From: koid Date: Mon, 18 Mar 2024 15:30:16 +0900 Subject: [PATCH] ignore bot pr option on github app mode --- pr_agent/servers/github_app.py | 6 ++++++ pr_agent/settings/configuration.toml | 1 + 2 files changed, 7 insertions(+) diff --git a/pr_agent/servers/github_app.py b/pr_agent/servers/github_app.py index fbe9db0f..5cbf3175 100644 --- a/pr_agent/servers/github_app.py +++ b/pr_agent/servers/github_app.py @@ -121,6 +121,12 @@ async def handle_new_pr_opened(body: Dict[str, Any], action: str, log_context: Dict[str, Any], agent: PRAgent): + # logic to ignore PRs opened by bot + if get_settings().get("GITHUB_APP.IGNORE_BOT_PR", False): + if re.match('.+\[bot]$', sender) is not None: + get_logger().info(f"Ignoring PR by sender '{sender}' due to github_app.ignore_bot_pr setting") + return {} + title = body.get("pull_request", {}).get("title", "") # logic to ignore PRs with specific titles (e.g. "[Auto] ...") diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 21ad264b..a1a30ef3 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -155,6 +155,7 @@ push_commands = [ "/review --pr_reviewer.num_code_suggestions=0", ] ignore_pr_title = [] +ignore_bot_pr = false [gitlab] url = "https://gitlab.com" # URL to the gitlab service