Skip to content

Commit 498a50f

Browse files
authored
fix(versioning/github-actions): treat floating tags as equal (#42809)
* fix(versioning/github-actions): treat floating tags as equal As noted in #42662, if a floating tag `@v2` is used, Renovate currently tries to roll it back to `@v1`, as it doesn't see that `@v2 === @v2`. * fix(versioning/github-actions): allow `v` prefix matching too
1 parent 192c11e commit 498a50f

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

lib/modules/versioning/github-actions/index.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,14 @@ describe('modules/versioning/github-actions/index', () => {
108108
${'1.0.0-rc'} | ${'1.0'} | ${false}
109109
${'invalid'} | ${'1'} | ${false}
110110
${'~latest'} | ${'1'} | ${false}
111-
${'1'} | ${'1'} | ${false}
112-
${'1.2'} | ${'1.2'} | ${false}
113-
${'1.2.3'} | ${'1.2.3'} | ${true}
111+
${'1'} | ${'1'} | ${true}
112+
${'1'} | ${'v1'} | ${true}
113+
${'v1'} | ${'v1'} | ${true}
114+
${'v1'} | ${'1'} | ${true}
115+
${'1.2'} | ${'1.2'} | ${true}
116+
${'1.2'} | ${'v1.2'} | ${true}
117+
${'v1.2'} | ${'v1.2'} | ${true}
118+
${'v1.2'} | ${'1.2'} | ${true}
114119
${'1.2.4'} | ${'1.2.3'} | ${false}
115120
${'not-semver-ver'} | ${'1'} | ${false}
116121
${'1.0.0-alpha'} | ${'1'} | ${false}

lib/modules/versioning/github-actions/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ function isGreaterThan(x: string, y: string): boolean {
131131
}
132132

133133
function matches(version: string, range: string): boolean {
134+
// if we have a valid floating tag provided, and it's the same as the range, treat it as the same
135+
if (
136+
parseVersionCoerced(version) &&
137+
massageValue(version) === massageValue(range)
138+
) {
139+
return true;
140+
}
141+
134142
const v = parseVersion(version);
135143
if (!v) {
136144
return false;

0 commit comments

Comments
 (0)