ci: fix node engine check (#7891)
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user