Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix node engine check #7891

Merged
merged 3 commits into from
Mar 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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