adding dist
This commit is contained in:
+21
-19
@@ -27505,15 +27505,9 @@ function validateLicenses(key, licenses) {
|
|||||||
if (licenses === undefined) {
|
if (licenses === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let invalid_licenses;
|
const invalid_licenses = licenses.filter(license => !(0, utils_1.isSPDXValid)(license));
|
||||||
try {
|
|
||||||
invalid_licenses = licenses.filter(license => !(0, utils_1.isSPDXValid)(license));
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
throw new Error(`Error validating license(s): ${error.message}`);
|
|
||||||
}
|
|
||||||
if (invalid_licenses.length > 0) {
|
if (invalid_licenses.length > 0) {
|
||||||
throw new Error(`Invalid license(s) in ${key}: ${invalid_licenses.join(', ')}`);
|
throw new Error(`Invalid license(s) in ${key}: ${invalid_licenses}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function readConfigFile(filePath) {
|
function readConfigFile(filePath) {
|
||||||
@@ -27537,25 +27531,33 @@ function readConfigFile(filePath) {
|
|||||||
return parseConfigFile(data);
|
return parseConfigFile(data);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.debug(error.message);
|
throw new Error(`Unable to fetch or parse config file: ${error.message}`);
|
||||||
throw new Error('Unable to fetch or parse config file');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function parseConfigFile(configData) {
|
function parseConfigFile(configData) {
|
||||||
try {
|
try {
|
||||||
const data = yaml_1.default.parse(configData);
|
const data = yaml_1.default.parse(configData);
|
||||||
|
// These are the options that we support where the user can provide
|
||||||
|
// either a YAML list or a comma-separated string.
|
||||||
|
const listKeys = [
|
||||||
|
'allow-licenses',
|
||||||
|
'deny-licenses',
|
||||||
|
'fail-on-scopes',
|
||||||
|
'allow-ghsas'
|
||||||
|
];
|
||||||
for (const key of Object.keys(data)) {
|
for (const key of Object.keys(data)) {
|
||||||
|
// strings can contain list values (e.g. 'MIT, Apache-2.0'). In this
|
||||||
|
// case we need to parse that into a list (e.g. ['MIT', 'Apache-2.0']).
|
||||||
|
if (listKeys.includes(key)) {
|
||||||
|
const val = data[key];
|
||||||
|
if (typeof val === 'string') {
|
||||||
|
data[key] = val.split(',').map(x => x.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// perform SPDX validation
|
||||||
if (key === 'allow-licenses' || key === 'deny-licenses') {
|
if (key === 'allow-licenses' || key === 'deny-licenses') {
|
||||||
const licenses = data[key];
|
validateLicenses(key, data[key]);
|
||||||
// handle the case where the user has a singe or invalid license
|
|
||||||
// in the config file
|
|
||||||
if (typeof licenses === 'string') {
|
|
||||||
validateLicenses(key, [licenses]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
validateLicenses(key, data[key]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// get rid of the ugly dashes from the actions conventions
|
// get rid of the ugly dashes from the actions conventions
|
||||||
if (key.includes('-')) {
|
if (key.includes('-')) {
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user