如何在Renovate的`postUpgradeTasks`中替换版本引用?

huangapple go评论87阅读模式
英文:

How to replace version references in Renovate `postUpgradeTasks`?

问题

我在GitLab上设置了renovatebot,以确保另一个存储库中的软件包版本保持更新。但除了相关的锁定文件之外,还有其他文件引用了特定的软件包版本。例如,在readme中:

如果您不想安装任何东西,可以使用
[mypy Playground](https://mypy-play.net/?flags=strict&mypy=1.3.0&python=3.8) 来
在浏览器中验证您的类型注释。

该URL的mypy=1.3.0部分应与poetry.lock中的mypy版本保持同步。这是否可能?基于文档,我提出了这个天真的实现,但我不确定如何测试它是否有效:

{
  "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"
  }
}
英文:

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"
  }
}

答案1

得分: 1

我应该使用regexManager而不是postUpgradeTasks

如果depName相同或者具有相同的groupName,它们将被合并到单个PR/MR中。

英文:

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.

huangapple
  • 本文由 发表于 2023年5月15日 10:44:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/76250583.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定