@@ -30,26 +30,22 @@ const isFromPhabricator = body_contains('differential revision:');
3030// Provides advice if a summary section is missing, or body is too short
3131const includesSummary = body_contains ( '## summary' , 'summary:' ) ;
3232
33- const snapshot_output = JSON . parse (
34- fs . readFileSync (
35- path . join (
36- process . env . RUNNER_TEMP ,
37- 'diff-js-api-breaking-changes/output.json' ,
38- ) ,
39- 'utf8' ,
40- ) ,
33+ const snapshot_path = path . join (
34+ process . env . RUNNER_TEMP ,
35+ 'diff-js-api-breaking-changes/output.json' ,
4136) ;
4237
43- console . log ( 'Snapshot output:' , snapshot_output ) ;
44-
45- if ( snapshot_output && snapshot_output . result !== 'NON_BREAKING' ) {
46- const title = ':exclamation: JavaScript API change detected' ;
47- const idea =
48- 'This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API. ' +
49- 'Please include a clear changelog message. ' +
50- 'This change will be subject to extra review.\n\n' +
51- `This change was flagged as: <code>${ snapshot_output . result } </code>` ;
52- warn ( `${ title } - <i>${ idea } </i>` ) ;
38+ if ( fs . existsSync ( snapshot_path ) ) {
39+ const snapshot_output = JSON . parse ( fs . readFileSync ( snapshot_path , 'utf8' ) ) ;
40+ if ( snapshot_output && snapshot_output . result !== 'NON_BREAKING' ) {
41+ const title = ':exclamation: JavaScript API change detected' ;
42+ const idea =
43+ 'This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API. ' +
44+ 'Please include a clear changelog message. ' +
45+ 'This change will be subject to extra review.\n\n' +
46+ `This change was flagged as: <code>${ snapshot_output . result } </code>` ;
47+ warn ( `${ title } - <i>${ idea } </i>` ) ;
48+ }
5349}
5450
5551const hasNoUsefulBody =
0 commit comments