|
13 | 13 | automerge_patch_v0 = "{{ cookiecutter.automerge_patch_v0 }}" == "y"
|
14 | 14 |
|
15 | 15 | automerge_patch_regexp_blocklist = "{{ cookiecutter.automerge_patch_regexp_blocklist }}"
|
| 16 | +automerge_patch_v0_regexp_allowlist = ( |
| 17 | + "{{ cookiecutter.automerge_patch_v0_regexp_allowlist }}" |
| 18 | +) |
16 | 19 |
|
17 | 20 | if not create_lib:
|
18 | 21 | shutil.rmtree("lib")
|
|
99 | 102 |
|
100 | 103 | renovatejson["packageRules"].append(patch_rule)
|
101 | 104 |
|
| 105 | +# If automerging of patch updates for v0.x dependencies is disabled by default, but automerging |
| 106 | +# is requested for some v0.x package patterns, we generate an additional package rule that |
| 107 | +# enables automerge only for dependencies that are currently v0.x and which match one of the |
| 108 | +# provided patterns. |
| 109 | +# This rule is not required and therefore not generated when `automerge_patch_v0` is enabled |
| 110 | +# globally. If you want to disable automerging for some v0.x patch level updates but merge those |
| 111 | +# updates by default, you can specify patterns for which no patch level updates should be merged |
| 112 | +# in cookiecutter argument `automerge_patch_regexp_blocklist`. |
| 113 | +if not automerge_patch_v0 and len(automerge_patch_v0_regexp_allowlist) > 0: |
| 114 | + patterns = automerge_patch_v0_regexp_allowlist.split(";") |
| 115 | + patch_v0_rule = { |
| 116 | + "matchUpdateTypes": ["patch"], |
| 117 | + # only apply for packages whose current version matches `v?0\.` |
| 118 | + "matchCurrentVersion": "/^v?0\\./", |
| 119 | + "automerge": True, |
| 120 | + # NOTE: We can't use Platform Automerge because the repositories are configured manually, |
| 121 | + # so we can't be sure the "require status checks" option is always enabled, and without |
| 122 | + # that, platformAutomerge does not wait for tests to pass. |
| 123 | + "platformAutomerge": False, |
| 124 | + # NOTE: We need to add all the labels we want here, renovate doesn't inherit globally |
| 125 | + # specified labels for package rules |
| 126 | + "labels": ["dependency", "automerge"], |
| 127 | + "matchPackagePatterns": patterns, |
| 128 | + } |
| 129 | + renovatejson["packageRules"].append(patch_v0_rule) |
| 130 | + |
102 | 131 | # NOTE: Later rules in `packageRules` take precedence
|
103 | 132 |
|
104 | 133 | with open("renovate.json", "w", encoding="utf-8") as f:
|
|
0 commit comments