Skip to content

Commit

Permalink
ignore bot pr option on github app mode
Browse files Browse the repository at this point in the history
  • Loading branch information
koid committed Mar 18, 2024
1 parent dd83b19 commit 781bc9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pr_agent/servers/github_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ async def handle_new_pr_opened(body: Dict[str, Any],
agent: PRAgent):
title = body.get("pull_request", {}).get("title", "")

# 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 {}

# logic to ignore PRs with specific titles (e.g. "[Auto] ...")
ignore_pr_title_re = get_settings().get("GITHUB_APP.IGNORE_PR_TITLE", [])
if not isinstance(ignore_pr_title_re, list):
Expand Down
1 change: 1 addition & 0 deletions pr_agent/settings/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 781bc9f

Please sign in to comment.