mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 18:06:45 +00:00
coerce
This commit is contained in:
parent
c86f786dcf
commit
c77138c273
2 changed files with 4 additions and 4 deletions
4
dist/setup/index.js
vendored
4
dist/setup/index.js
vendored
|
@ -105060,8 +105060,8 @@ function run() {
|
||||||
core.debug("JAVA_VERSION input is empty, looking for .java-version file");
|
core.debug("JAVA_VERSION input is empty, looking for .java-version file");
|
||||||
const versionFileName = '.java-version';
|
const versionFileName = '.java-version';
|
||||||
const contents = fs_1.default.readFileSync(versionFileName).toString().trim();
|
const contents = fs_1.default.readFileSync(versionFileName).toString().trim();
|
||||||
const cleanedStr = semver.clean(contents, { loose: true });
|
const coercedStr = semver.coerce(contents, { loose: true });
|
||||||
const version = semver.valid(cleanedStr);
|
const version = semver.valid(coercedStr);
|
||||||
core.info(version ? version : "not found");
|
core.info(version ? version : "not found");
|
||||||
versions.push(contents);
|
versions.push(contents);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ async function run() {
|
||||||
core.debug("JAVA_VERSION input is empty, looking for .java-version file")
|
core.debug("JAVA_VERSION input is empty, looking for .java-version file")
|
||||||
const versionFileName = '.java-version'
|
const versionFileName = '.java-version'
|
||||||
const contents = fs.readFileSync(versionFileName).toString().trim();
|
const contents = fs.readFileSync(versionFileName).toString().trim();
|
||||||
const cleanedStr = semver.clean(contents, { loose: true })
|
const coercedStr = semver.coerce(contents, { loose: true })
|
||||||
const version = semver.valid(cleanedStr);
|
const version = semver.valid(coercedStr);
|
||||||
core.info(version ? version : "not found")
|
core.info(version ? version : "not found")
|
||||||
versions.push(contents)
|
versions.push(contents)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue