ci: fix node engine check (#7891)

This commit is contained in:
Manuel
2022-03-25 19:47:05 +01:00
committed by Manuel Trezza
parent a8aef820af
commit d609c72783

View File

@@ -75,17 +75,21 @@ class NodeEngineCheck {
// For each file // For each file
for (const file of files) { for (const file of files) {
// Get node version // Get node version
const contentString = await fs.readFile(file, 'utf-8'); const contentString = await fs.readFile(file, 'utf-8');
const contentJson = JSON.parse(contentString); try {
const version = ((contentJson || {}).engines || {}).node; const contentJson = JSON.parse(contentString);
const version = ((contentJson || {}).engines || {}).node;
// Add response // Add response
response.push({ response.push({
file: file, file: file,
nodeVersion: version nodeVersion: version
}); });
} catch(e) {
console.log(`Ignoring file because it is not valid JSON: ${file}`);
core.warning(`Ignoring file because it is not valid JSON: ${file}`);
}
} }
// If results should be cleaned by removing undefined node versions // If results should be cleaned by removing undefined node versions