Skip to content

Commit

Permalink
docs(config options): rewrite matchPaths and matchFiles (#21582)
Browse files Browse the repository at this point in the history
Co-authored-by: Rhys Arkins <rhys@arkins.net>
  • Loading branch information
HonkingGoose and rarkins committed Apr 26, 2023
1 parent 9ba7c40 commit dc1d1e8
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions docs/usage/configuration-options.md
Expand Up @@ -1833,22 +1833,25 @@ For example, if you have an `examples` directory and you want all updates to tho
}
```

If you wish to limit Renovate to apply configuration rules to certain files in the root repository directory, you have to use `matchPaths` with either a partial string match or a minimatch pattern.
If you wish to limit Renovate to apply configuration rules to certain files in the root repository directory, you have to use `matchPaths` with a `minimatch` pattern or use [`matchFiles`](#matchfiles) with an exact match.
For example you have multiple `package.json` and want to use `dependencyDashboardApproval` only on the root `package.json`:

```json
{
"packageRules": [
{
"matchPaths": ["+(package.json)"],
"matchFiles": ["package.json"],
"dependencyDashboardApproval": true
}
]
}
```

Important to know: Renovate will evaluate all `packageRules` and not stop once it gets a first match.
You should order your `packageRules` in ascending order of importance so that more important rules come later and can override settings from earlier rules if needed.
<!-- prettier-ignore -->
!!! tip
Renovate evaluates all `packageRules` and does not stop after the first match.
Order your `packageRules` so the least important rules are at the _top_, and the most important rules at the _bottom_.
This way important rules override settings from earlier rules if needed.

<!-- prettier-ignore -->
!!! warning
Expand Down Expand Up @@ -2138,11 +2141,17 @@ Renovate will compare `matchFiles` for an exact match against the dependency's p

For example the following would match `package.json` but not `package/frontend/package.json`:

```
"matchFiles": ["package.json"],
```json
{
"packageRules": [
{
"matchFiles": ["package.json"]
}
]
}
```

Use `matchPaths` instead if you need more flexible matching.
Use [`matchPaths`](#matchpaths) instead if you need more flexible matching.

### matchDepNames

Expand Down Expand Up @@ -2204,9 +2213,9 @@ Just like the earlier `matchPackagePatterns` example, the above will configure `

### matchPaths

Renovate finds the file(s) listed in `matchPaths` with a minimatch glob pattern.
Renovate finds the file(s) listed in `matchPaths` with a `minimatch` glob pattern.

For example the following would match any `package.json`, including files like `backend/package.json`:
For example the following matches any `package.json`, including files like `backend/package.json`:

```json
{
Expand All @@ -2220,7 +2229,7 @@ For example the following would match any `package.json`, including files like `
}
```

The following would match any file in directories starting with `app/`:
The following matches any file in directories starting with `app/`:

```json
{
Expand All @@ -2234,6 +2243,11 @@ The following would match any file in directories starting with `app/`:
}
```

<!-- prettier-ignore -->
!!! warning
Partial matches for `matchPaths` are deprecated.
Please use a `minimatch` glob pattern or switch to [`matchFiles`](#matchfiles) if you need exact matching.

### matchSourceUrlPrefixes

Here's an example of where you use this to group together all packages from the `renovatebot` GitHub org:
Expand Down

0 comments on commit dc1d1e8

Please sign in to comment.