mirror of
https://github.com/actions/setup-python
synced 2025-04-05 06:49:43 +00:00
Add range validation for toml files (#726)
This commit is contained in:
11
dist/setup/index.js
vendored
11
dist/setup/index.js
vendored
@ -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;
|
||||
/**
|
||||
|
Reference in New Issue
Block a user