refactor: consolidate PR ignore logic into a single function and update documentation

This commit is contained in:
mrT23
2024-09-07 10:34:57 +03:00
parent 9199d84796
commit 147a8e0ef3
6 changed files with 182 additions and 119 deletions

View File

@ -115,33 +115,25 @@ LANGSMITH_BASE_URL=<url>
## Ignoring automatic commands in PRs
In some cases, you may want to ignore automatic commands in PRs. For example you may want to ignore MR with a specific title, or labels or from/to specific branches.
In some cases, you may want to automatically ignore specific PRs . PR-Agent enables you to ignore PR with a specific title, or from/to specific branches (regex matching).
For example, to ignore MRs with a specific title such as "[AUTO]: foobar", you can add the following to your `configuration.toml` file:
To ignore PRs with a specific title such as "[Bump]: ...", you can add the following to your `configuration.toml` file:
```
[config]
ignore_mr_title = ["\\[AUTO\\]"]
ignore_pr_title = ["\\[Bump\\]"]
```
Where the `ignore_mr_title` is a list of regex patterns to match the MR title you want to ignore.
Where the `ignore_pr_title` is a list of regex patterns to match the PR title you want to ignore. Default is `ignore_pr_title = ["^\\[Auto\\]", "^Auto"]`.
To ignore MRs with specific labels, you can add the following to your `configuration.toml` file:
To ignore PRs from specific source or target branches, you can add the following to your `configuration.toml` file:
```
[config]
ignore_mr_labels = ["auto"]
ignore_pr_source_branches = ['develop', 'main', 'master', 'stage']
ignore_pr_target_branches = ["qa"]
```
Where the `ignore_mr_labels` is a list of labels you want to ignore.
To ignore MRs from specific branches, you can add the following to your `configuration.toml` file:
```
[config]
ignore_mr_source_branches = ['develop', 'main', 'master', 'stage']
ignore_mr_target_branches = ["qa"]
```
Where the `ignore_mr_source_branches` and `ignore_mr_target_branches` are lists of regex patterns to match the source and target branches you want to ignore.
Where the `ignore_pr_source_branches` and `ignore_pr_target_branches` are lists of regex patterns to match the source and target branches you want to ignore.
They are not mutually exclusive, you can use them together or separately.