Skip to content

Commit

Permalink
ci: fix node engine check (#7891)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza committed May 1, 2022
1 parent a8aef82 commit d609c72
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions ci/nodeEngineCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,21 @@ class NodeEngineCheck {

// For each file
for (const file of files) {

// Get node version
const contentString = await fs.readFile(file, 'utf-8');
const contentJson = JSON.parse(contentString);
const version = ((contentJson || {}).engines || {}).node;

// Add response
response.push({
file: file,
nodeVersion: version
});
try {
const contentJson = JSON.parse(contentString);
const version = ((contentJson || {}).engines || {}).node;

// Add response
response.push({
file: file,
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
Expand Down

0 comments on commit d609c72

Please sign in to comment.