Search code examples
renovate

How to replace version references in Renovate `postUpgradeTasks`?


I've set up renovatebot on GitLab to keep package versions in another repository up to date. But outside of the relevant lock file there are other files which also reference certain package versions. For example, in the readme:

If you don't want to install anything you can use
[mypy Playground](https://mypy-play.net/?flags=strict&mypy=1.3.0&python=3.8) to
verify your type annotations in a browser.

The mypy=1.3.0 part of that URL should be kept in sync with the mypy version in poetry.lock. Is this possible? Based on the documentation I've come up with this naive implementation, but I'm not sure how to test it or whether it'll work:

{
  "postUpgradeTasks": {
    "commands": ["sed -i -e \"s/mypy=.*&/mypy=/$(poetry show mypy | grep ' version .*' | cut --delimiter=: --fields=2 | cut --delimiter=' ' --fields=2)\" README.md"],
    "fileFilters": ["poetry.lock", "README.md"],
    "executionMode": "update"
  }
}

Solution

  • Rather postUpgradeTasks you probably want to use a regexManager.

    If the depNames are identically or have the same groupName they also will be combined in a single PR/MR.