You are currently viewing Automating Changelog Updates in Renovate Bot PRs

Automating Changelog Updates in Renovate Bot PRs

When using Renovate Bot for dependency updates in a releaseable project, you might find that adding the changelog update is not done for you.

A developer needs to manually check out the renovate PR, run the changelog command e.g. yarn change, and commit the generated change files.

This is tedious and slows down the update process.

Renovate postUpgradeTasks

Renovate provides a postUpgradeTasks feature that allows running commands after an upgrade.

We can leverage this to automate changelog updates.

Please note this is only available in self-hosted renovate instances. If you are using the hosted version of renovate, a custom pipeline/action can be created to automatically add the changeset commits.

Configuration

Add the following to your Renovate configuration file (renovate.json):

  "postUpgradeTasks": {
    "commands": [
      "yarn change --type patch --message \"$(git show -s --format=%s | sed 's/\"/\\\\"/g')\""
    ],
    "fileFilters": ["**/package.json"]
  },
Code language: JSON / JSON with Comments (json)

Explanation

  • postUpgradeTasks.commands: Runs yarn change automatically, using the latest commit message as the changelog entry.
  • fileFilters: Ensures the command runs only when package.json changes.
  • Escaping Quotes: The sed command prevents issues with double quotes in commit messages.

Benefits

✅ No more manual changelog updates for dependency upgrades.
✅ Faster PR handling and merging.
✅ Consistent changelog entries.

With postUpgradeTasks, Renovate can handle dependency updates more efficiently by automating changelog generation. Try adding this to your workflow and eliminate the manual effort!

Umut Esen

I am a software developer and blogger with a passion for the world wide web.

Leave a Reply