File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,21 @@ class NodeEngineCheck {
7575
7676 // For each file
7777 for ( const file of files ) {
78-
7978 // Get node version
8079 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+ }
8993 }
9094
9195 // If results should be cleaned by removing undefined node versions
You can’t perform that action at this time.
0 commit comments