Search code examples
githubrenovate

Configure renovate bot to merge minor and patch updates automatically


On my GitHub repo I want to configure the renovate bot to automatically merge all minor (and smaller) updates automatically and to create PRs only for major updates. If I understand the doc correctly, my package rules should configure that behaviour:

{
  "extends": [
    "config:base",
    ":disableDependencyDashboard"
  ],
  "ignorePaths": [
    "Dockerfile",
    "package.json",
    "pnpm-lock.yaml"
  ],
  "assignees": [
    "McPringle"
  ],
  "reviewers": [
    "McPringle"
  ],
  "packageRules": [
    {
      "matchUpdateTypes": ["minor", "patch", "pin", "digest"],
      "automerge": true
    },
    {
      "matchDepTypes": ["devDependencies"],
      "automerge": true
    }
  ]
}

But the renovate bot does not merge the minor updates. Still, everything comes as a PR, which I have to merge manually. This is an example:

-    <version>2.6.1</version>
+    <version>2.6.2</version>

This patch update should be merged automatically. Can someone please explain what I am understanding and doing wrong? Here you can find the GitHub repo I'm talking about including the renovate config file and the PR, which I have not merged now: https://github.com/komunumo/komunumo-server


Solution

  • Here I am documenting my solution which I found with the help from the Renovate discussion forum at GitHub:

    1. In renovate.json, configure packageRules with automerge and activate platformAutomerge:
    {
      "extends": [
        "config:base"
      ],
      "packageRules": [
        {
          "matchUpdateTypes": ["minor", "patch", "pin", "digest"],
          "automerge": true
        },
        {
          "matchDepTypes": ["devDependencies"],
          "automerge": true
        }
      ],
      "platformAutomerge": true
    }
    
    1. In the GitHub repository settings, go to Option and activate at least Allow auto-merge and Automatically delete head branches: GitHub option setting screenshot

    2. In the GitHub repository settings, go to Branches and add a branch protection rule for your main or master branch (whatever you are using). Activate Require status checks to pass before merging and Require branches to be up to date before merging. If GitHub tells you "No status checks found", just ignore that. Rules must be saved explicitly (scroll down to the "Save" button). GitHub branch setting screenshot

    The next PR from the renovate bot should be merged automatically.