From 8b9bfbe4f46c07d4c18bac3959ae876f59a8e408 Mon Sep 17 00:00:00 2001 From: Michael Kriese <michael.kriese@visualon.de> Date: Tue, 11 Feb 2020 14:15:40 +0100 Subject: [PATCH] docs: add paths example (#5433) Co-authored-by: Rhys Arkins <rhys@arkins.net> --- docs/usage/configuration-options.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index 12e9cf481e..8f9d38a979 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -869,6 +869,19 @@ Path rules are convenient to use if you wish to apply configuration rules to cer } ``` +If you wish to limit renovate to apply configuration rules to certain files in the root repository directory, you have to use `paths` with either a partial string match or a minimatch pattern. For example you have multiple `package.json` and want to use `masterIssueApproval` only on the root `package.json`: + +```json +{ + "packageRules": [ + { + "paths": ["+(package.json)"], + "masterIssueApproval": true + } + ] +} +``` + Important to know: Renovate will evaluate all `packageRules` and not stop once it gets a first match. Therefore, you should order your `packageRules` in order of importance so that later rules can override settings from earlier rules if necessary. ### allowedVersions @@ -1029,6 +1042,18 @@ The above will configure `rangeStrategy` to `replace` for any package starting w ### paths +Renovate will match `paths` against both a partial string match or a minimatch glob pattern. If you want to avoid the partial string matching so that only glob matching is performed, wrap your string in `+(...)` like so: + +``` + "paths": ["+(package.json)"], +``` + +The above will match only the root `package.json`, whereas the following would match any `package.json` in any subdirectory too: + +``` + "paths": ["package.json"], +``` + ### sourceUrlPrefixes Here's an example of where you use this to group together all packages from the Vue monorepo: -- GitLab