mirror of
https://github.com/ButlerLogic/action-autotag.git
synced 2024-11-22 00:01:08 +07:00
fix: ensure that versions are valid SerVer before comparing
This commit is contained in:
parent
2451ded74e
commit
f558f9692c
13
app/main.js
13
app/main.js
@ -51,7 +51,18 @@ async function run () {
|
||||
}
|
||||
|
||||
const minVersion = core.getInput('minVersion', { required: false })
|
||||
if (semver.lt(version, minVersion)) {
|
||||
|
||||
// Ensure that version and minVersion are valid SemVer strings
|
||||
const minVersionSemVer = semver.coerce(minVersion)
|
||||
const versionSemVer = semver.coerce(version)
|
||||
if (!minVersionSemVer) {
|
||||
core.warning(`Skipping min version check. ${minVersion} is not valid SemVer`)
|
||||
}
|
||||
if(!versionSemVer) {
|
||||
core.warning(`Skipping min version check. ${version} is not valid SemVer`)
|
||||
}
|
||||
|
||||
if (minVersionSemVer && versionSemVer && semver.lt(versionSemVer, minVersion)) {
|
||||
core.warning(`Version "${version}" is lower than minimum "${minVersion}"`)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user