Skip to main content
Skip table of contents

How to Configure Renovate Pull Request Contents

Introduction

Renovate is a product included in Mend’s Developer Integrations. It generates pull requests (PRs) that update out of date versions of open source libraries. The PRs generated by Renovate include information about the open source library and the update being made. Occasionally you may have need to alter the contents of the PRs. For example, the PRs include a link to the library location for every library being updated. If your project includes libraries located in a private repository, then its possible that the link will not resolve to a viewable source. This can cause some confusion when investigating PR’s before merging them to your repository.

Prerequisites

You have enabled Renovate on your repository - How to Enable Renovate for Mend Repository Integrations

You have configured Renovate per the Renovate documentation - https://docs.renovatebot.com/

Pull Request Body Definitions

Renovate PRs include a PR Body Definition that defines the template for the body of the PR. This is something that you can edit, to make it display however you need for your repository. For example, the default prBodyDefinition for npm dependencies looks like:

CODE
prBodyDefinitions: {
    Change:
      "[{{#if displayFrom}}`{{{displayFrom}}}` -> {{else}}{{#if currentValue}}`{{{currentValue}}}` -> {{/if}}{{/if}}{{#if displayTo}}`{{{displayTo}}}`{{else}}`{{{newValue}}}`{{/if}}]({{#if depName}}https://renovatebot.com/diffs/npm/{{replace '/' '%2f' depName}}/{{{currentVersion}}}/{{{newVersion}}}{{/if}})",
  },

Changing the prBodyDefinition

In order to adjust the prBodyDefinition you can override the behavior through your Renovate configuration. This configuration should be placed inside the renovate portion of your “.whitesource” file. Below is an example:

CODE
"packageRules": [{
  "matchPackagePatterns": ["@web/"],
  "prBodyDefinitions": {
    "Change":
      "{{#if displayFrom}}`{{{displayFrom}}}` -> {{else}}{{#if currentValue}}`{{{currentValue}}}` -> {{/if}}{{/if}}{{#if displayTo}}`{{{displayTo}}}`{{else}}`{{{newValue}}}`{{/if}}",
  },
}]

This example specifies that for any package starting with “@web/” to remove the link in the “Change” section of the Pull Request. You can also use “matchPackageNames” if you want to specify specific package names instead of a pattern.

Summary

Once you have a basic understanding of Pull Requests created by Remediate with Renovate, along with the the prBodyDefinition configuration options, you can change the contents of the pull requests generated by Renovate.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.