Update util.ts

This commit is contained in:
guicamest 2025-11-14 17:39:57 +01:00 committed by GitHub
parent 507f216ca0
commit ebfc458f30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,16 +140,16 @@ export function getVersionFromFileContent(
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
}
const fileContent = content.match(javaVersionRegExp)?.groups?.version
const capturedVersion = content.match(javaVersionRegExp)?.groups?.version
? (content.match(javaVersionRegExp)?.groups?.version as string)
: '';
if (!fileContent) {
core.debug(`Parsed version '${capturedVersion}' from file '${versionFileName}'`);
if (!capturedVersion) {
return null;
}
core.debug(`Version from file '${fileContent}'`);
const tentativeVersion = avoidOldNotation(fileContent);
const tentativeVersion = avoidOldNotation(capturedVersion);
const rawVersion = tentativeVersion.split('-')[0];
let version = semver.validRange(rawVersion)