Search code examples
renovate

How to only create a PR for matchedDependencies with Renovate


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"
    }
  ]
}

Solution

  • 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"
        }
      ]