clean string

This commit is contained in:
Evgenii Korolevskii 2022-11-24 16:50:35 +01:00
parent 71a377dea9
commit af8b898a83
2 changed files with 4 additions and 2 deletions

View file

@ -25,7 +25,8 @@ async function run() {
core.debug("JAVA_VERSION input is empty, looking for .java-version file")
const versionFileName = '.java-version'
const contents = fs.readFileSync(versionFileName).toString().trim();
const version = semver.valid(contents);
const cleanedStr = semver.clean(' = v 2.1.5foo', { loose: true })
const version = semver.valid(cleanedStr);
core.info(version ? version : "not found")
versions.push(contents)
}