How to only create a PR for matchedDependencies with Renovate

1.7k Views Asked by At

I want to only create a Pull Request for the below specified dependencies. All other dependencies should not be considered. The config below does not do that because I get separate PR's for all dependencies that do not match the rules I specified. For example I get a PR for SimpleInjector. How can I get one PR only for the Dependencies that match, but no other PR's at all without creating explicit exclusion rules for every dependency?

  "packageRules": [
    {
      "matchPackagePatterns": [
        "System.*",
      ],
      "excludePackageNames": ["Microsoft.CodeAnalysis.FxCopAnalyzers"],
      "matchUpdateTypes": [
        "minor",
        "patch"
      ],
      "groupName": "non major",
      "groupSlug": "non-major"
    }
  ]
}
2

There are 2 best solutions below

1
On BEST ANSWER

There are two things to know that were key to solve this problem:

  • Rules get evaluated from top to bottom
  • All dependencies get updated by default

The config below disables all dependencies first and then selectively enables some dependencies again:

"packageRules": [
    {
      "matchPackagePatterns": ["*"],
      "enabled": false
    },
    {
      "matchPackagePatterns": [
        "System.*",
      ],
      "enabled": true
    },
    {
      "matchUpdateTypes": [
        "minor",
        "patch"
      ],
      "groupSlug": "non-major"
    }
  ]
0
On

Read here: https://docs.renovatebot.com/configuration-options/#packagerules

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.

enter image description here