diff --git a/docs/docs/usage-guide/additional_configurations.md b/docs/docs/usage-guide/additional_configurations.md index 38ed9ded..21c27f9c 100644 --- a/docs/docs/usage-guide/additional_configurations.md +++ b/docs/docs/usage-guide/additional_configurations.md @@ -2,8 +2,7 @@ In some cases, you may want to exclude specific files or directories from the analysis performed by CodiumAI PR-Agent. This can be useful, for example, when you have files that are generated automatically or files that shouldn't be reviewed, like vendored code. -The default ignore settings are defined in **[ignore.toml](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/ignore.toml)** configuration file. This setting also exposes the following environment variables: - +You can ignore files or folders using the following methods: - `IGNORE.GLOB` - `IGNORE.REGEX` diff --git a/docs/docs/usage-guide/automations_and_usage.md b/docs/docs/usage-guide/automations_and_usage.md index f8d55409..96545e1a 100644 --- a/docs/docs/usage-guide/automations_and_usage.md +++ b/docs/docs/usage-guide/automations_and_usage.md @@ -81,7 +81,7 @@ Every time you run the `describe` tool, including automatic runs, the PR title w To cancel the automatic run of all the tools, set: ``` [github_app] -handle_pr_actions = [] +pr_commands = [] ``` You can also disable automatic runs for PRs with specific titles, by setting the `ignore_pr_titles` parameter with the relevant regex. For example: diff --git a/pr_agent/servers/github_app.py b/pr_agent/servers/github_app.py index 06b5905a..afa7b697 100644 --- a/pr_agent/servers/github_app.py +++ b/pr_agent/servers/github_app.py @@ -130,19 +130,21 @@ async def handle_new_pr_opened(body: Dict[str, Any], title = body.get("pull_request", {}).get("title", "") get_settings().config.is_auto_command = True - # 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): - ignore_pr_title_re = [ignore_pr_title_re] - if ignore_pr_title_re and any(re.search(regex, title) for regex in ignore_pr_title_re): - get_logger().info(f"Ignoring PR with title '{title}' due to github_app.ignore_pr_title setting") - return {} pull_request, api_url = _check_pull_request_event(action, body, log_context) if not (pull_request and api_url): get_logger().info(f"Invalid PR event: {action=} {api_url=}") return {} if action in get_settings().github_app.handle_pr_actions: # ['opened', 'reopened', 'ready_for_review'] + # logic to ignore PRs with specific titles (e.g. "[Auto] ...") + apply_repo_settings(api_url) + ignore_pr_title_re = get_settings().get("GITHUB_APP.IGNORE_PR_TITLE", []) + if not isinstance(ignore_pr_title_re, list): + ignore_pr_title_re = [ignore_pr_title_re] + if ignore_pr_title_re and any(re.search(regex, title) for regex in ignore_pr_title_re): + get_logger().info(f"Ignoring PR with title '{title}' due to github_app.ignore_pr_title setting") + return {} + if get_identity_provider().verify_eligibility("github", sender_id, api_url) is not Eligibility.NOT_ELIGIBLE: await _perform_auto_commands_github("pr_commands", agent, body, api_url, log_context) else: