Skip to content

Commit 7b29d88

Browse files
committed
Update nodeEngineCheck.js
1 parent 852bb47 commit 7b29d88

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

ci/nodeEngineCheck.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const core = require('@actions/core');
22
const semver = require('semver');
33
const fs = require('fs').promises;
44
const path = require('path');
5+
const { createCipheriv } = require('crypto');
56

67
/**
78
* This checks whether any package dependency requires a minimum node engine
@@ -75,17 +76,20 @@ class NodeEngineCheck {
7576

7677
// For each file
7778
for (const file of files) {
78-
7979
// Get node version
8080
const contentString = await fs.readFile(file, 'utf-8');
81-
const contentJson = JSON.parse(contentString);
82-
const version = ((contentJson || {}).engines || {}).node;
83-
84-
// Add response
85-
response.push({
86-
file: file,
87-
nodeVersion: version
88-
});
81+
try {
82+
const contentJson = JSON.parse(contentString);
83+
const version = ((contentJson || {}).engines || {}).node;
84+
85+
// Add response
86+
response.push({
87+
file: file,
88+
nodeVersion: version
89+
});
90+
} catch(e) {
91+
core.warning(`Ignoring file because it is not valid JSON: ${file}`);
92+
}
8993
}
9094

9195
// If results should be cleaned by removing undefined node versions

0 commit comments

Comments
 (0)