Add range validation for toml files (#726)

This commit is contained in:
Dmitry Shibanov
2023-09-07 15:45:09 +02:00
committed by GitHub
parent f97b83114c
commit 65d7f2d534
4 changed files with 29 additions and 6 deletions

11
dist/setup/index.js vendored
View File

@ -70143,7 +70143,16 @@ function getVersionInputFromTomlFile(versionFile) {
versions.push(version);
}
core.info(`Extracted ${versions} from ${versionFile}`);
return Array.from(versions, version => version.split(',').join(' '));
const rawVersions = Array.from(versions, version => version.split(',').join(' '));
const validatedVersions = rawVersions
.map(item => semver.validRange(item, true))
.filter((versionRange, index) => {
if (!versionRange) {
core.debug(`The version ${rawVersions[index]} is not valid SemVer range`);
}
return !!versionRange;
});
return validatedVersions;
}
exports.getVersionInputFromTomlFile = getVersionInputFromTomlFile;
/**