This commit is contained in:
mrT23
2024-06-27 08:27:49 +03:00
parent 55a82382ef
commit ca18f85294
3 changed files with 11 additions and 10 deletions

View File

@ -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. 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.GLOB`
- `IGNORE.REGEX` - `IGNORE.REGEX`

View File

@ -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: To cancel the automatic run of all the tools, set:
``` ```
[github_app] [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: You can also disable automatic runs for PRs with specific titles, by setting the `ignore_pr_titles` parameter with the relevant regex. For example:

View File

@ -130,7 +130,14 @@ async def handle_new_pr_opened(body: Dict[str, Any],
title = body.get("pull_request", {}).get("title", "") title = body.get("pull_request", {}).get("title", "")
get_settings().config.is_auto_command = True get_settings().config.is_auto_command = True
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] ...") # 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", []) ignore_pr_title_re = get_settings().get("GITHUB_APP.IGNORE_PR_TITLE", [])
if not isinstance(ignore_pr_title_re, list): if not isinstance(ignore_pr_title_re, list):
ignore_pr_title_re = [ignore_pr_title_re] ignore_pr_title_re = [ignore_pr_title_re]
@ -138,11 +145,6 @@ async def handle_new_pr_opened(body: Dict[str, Any],
get_logger().info(f"Ignoring PR with title '{title}' due to github_app.ignore_pr_title setting") get_logger().info(f"Ignoring PR with title '{title}' due to github_app.ignore_pr_title setting")
return {} 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']
if get_identity_provider().verify_eligibility("github", sender_id, api_url) is not Eligibility.NOT_ELIGIBLE: 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) await _perform_auto_commands_github("pr_commands", agent, body, api_url, log_context)
else: else: