File tree 1 file changed +13
-9
lines changed
1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,21 @@ class NodeEngineCheck {
75
75
76
76
// For each file
77
77
for ( const file of files ) {
78
-
79
78
// Get node version
80
79
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
- } ) ;
80
+ try {
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
+ } ) ;
89
+ } catch ( e ) {
90
+ console . log ( `Ignoring file because it is not valid JSON: ${ file } ` ) ;
91
+ core . warning ( `Ignoring file because it is not valid JSON: ${ file } ` ) ;
92
+ }
89
93
}
90
94
91
95
// If results should be cleaned by removing undefined node versions
You can’t perform that action at this time.
0 commit comments