Skip to content

Commit e477026

Browse files
phermsdorfviceice
andauthored
feat(datasource/maven): remove additional placeholders for scm.url (renovatebot#37332)
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
1 parent a77e1ba commit e477026

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/modules/datasource/maven/__fixtures__/pom.scm-prefix.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<name>Generic Package</name>
1212
<description>Generic Maven Package</description>
1313
<scm>
14-
<url>scm:https://github.com/example/test</url>
14+
<url>scm:https://github.com/example/test/tree/${project.scm.tag}</url>
1515
<connection>scm:git@github.com:example/test.git</connection>
1616
<developerConnection>scm:git@github.com:example/test.git</developerConnection>
1717
</scm>

lib/modules/datasource/maven/util.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ function containsPlaceholder(str: string): boolean {
276276
return regEx(/\${.*?}/g).test(str);
277277
}
278278

279+
function removeKnownPlaceholders(str: string): string {
280+
return str.replace(regEx(/\/tree\/\${[^}]+}/), '');
281+
}
282+
279283
export function getMavenUrl(
280284
dependency: MavenDependency,
281285
repoUrl: string,
@@ -454,7 +458,10 @@ export async function getDependencyInfo(
454458
}
455459

456460
const sourceUrl = pomContent.valueWithPath('scm.url');
457-
if (sourceUrl && !containsPlaceholder(sourceUrl)) {
461+
if (
462+
sourceUrl &&
463+
!containsPlaceholder(removeKnownPlaceholders(sourceUrl))
464+
) {
458465
result.sourceUrl = sourceUrl
459466
.replace(regEx(/^scm:/), '')
460467
.replace(regEx(/^git:/), '')

0 commit comments

Comments
 (0)