2

I'm trying to setup RenovateBot. I've configured it to automerge all pull requests it makes, but it doesn't seem able to since we also have a repository policy to require at least one approval.

renovate.json

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "config:js-app"
  ],
  "baseBranches": ["main"],
  "lockFileMaintenance": { "enabled": true },
  "automerge": true
}

In the pull request, it says it will auto approve:

Renovate configuration
 Schedule: At any time (no schedule defined).

 Automerge: Enabled.

♻️ Rebasing: Whenever PR is behind base branch, or rename PR to start with "rebase!".

 Immortal: This PR will be recreated if closed unmerged. Get config help  if that's undesired.

This PR has been generated by Renovate Bot .

There are no errors in the RenovateBot logs

INFO: Repository started (repository=<ORG>/DependencyUpdater)
       "renovateVersion": "24.78.3"
 INFO: Dependency extraction complete (repository=<ORG>/DependencyUpdater)
       "baseBranch": "main",
       "stats": {
         "managers": {"npm": {"fileCount": 1, "depCount": 1}},
         "total": {"fileCount": 1, "depCount": 1}
       }
 INFO: PR updated (repository=<ORG>/DependencyUpdater, branch=renovate/pin-dependencies)
       "pr": 5,
       "prTitle": "Pin dependency renovate to 24.78.3"
 INFO: Repository finished (repository=<ORG>/DependencyUpdater)
       "durationMs": 8798

Renovate is logged in as the Service User, which has the Contribute, Contribute to pull requests and Create branch permissions.

How can I configure Renovate/Azure DevOps to allow these pull requests to be autocompleted?

My thinking is that I need to somehow make Renovate self-approve these pull requests (although I guess that could only work because I tell ADO to require at least one approval. if it needed 2 approvals then we'd be out of luck)

berkeleybross
  • 1,314
  • 2
  • 13
  • 27
  • Hi @berkeleybross, how are things going? Are the explanation and suggestion in my answer helpful to you? Please check it. Feel free to tell us if you have any question about this. – Bright Ran-MSFT Mar 24 '21 at 06:38

2 Answers2

1

Normally, by default the automergeing tool will auto-merge the PR only when all the required branch policies (if any) have been met. The same is true for Renovate.

If you have mandatory Pull Request reviews then it means Renovate can't auto-merge its own PR until such a review has happened.

There are two approval helper apps ('renovate-approve' and 'renovate-approve-2') can mark all automerging Pull Requests by Renovate as approved. But these two apps are only available for GitHub. For more details, you can see here.

There is not any available feature or extension for Renovate can auto-approve PR or bypass the required reviews on Azure DevOps. So, currently before the automerging, the required reviewers must manually approve the PR. Or if the approval is not must required on the PR, you can disable it from the branch policies.

Bright Ran-MSFT
  • 5,190
  • 1
  • 5
  • 12
0

This is possible as of 14/07/23.

The following config will get Renovate to automatically set the PR to complete once it has met the required policy. Note that this config does not set the Automatic Approval configuration property, which would lead the PR in your mentioned use case to be immediately merged.

Contents of renovate.json within the repository itself:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "platform": "azure",
  "automerge": true,
  "automergeType": "pr",
  "platformAutomerge": true
}

If you want this behaviour across all repositories, you can set this in your global renovate config.js using the below:

module.exports = {
  platform: 'azure',
  endpoint: 'https://dev.azure.com/YOUR_ORG_HERE/',
  automerge: true,
  automergeType: 'pr',
  platformAutomerge: true
}

Relevant links for the associated configuration:

James G
  • 2,069
  • 16
  • 28