diff --git a/.github/actions/diff-js-api-breaking-changes/action.yml b/.github/actions/diff-js-api-breaking-changes/action.yml index bc45b1b207aa83..8dbd744916d938 100644 --- a/.github/actions/diff-js-api-breaking-changes/action.yml +++ b/.github/actions/diff-js-api-breaking-changes/action.yml @@ -17,6 +17,9 @@ runs: env: SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes run: | + # Check if the file was changed in this PR, if not, exit early without saving to the output.json + git diff --name-status | awk '{print $2}' | grep 'packages/react-native/ReactNativeApi.d.ts' || exit 0 + node ./scripts/js-api/diff-api-snapshot \ ${{ github.workspace }}/packages/react-native/ReactNativeApi.d.ts \ $SCRATCH_DIR/ReactNativeApi-after.d.ts \ diff --git a/.github/workflows/danger-pr.yml b/.github/workflows/danger-pr.yml index cf28b788105a76..06daf7ee8378c8 100644 --- a/.github/workflows/danger-pr.yml +++ b/.github/workflows/danger-pr.yml @@ -15,7 +15,7 @@ permissions: jobs: danger: runs-on: ubuntu-latest - if: github.repository == 'facebook/react-native' + if: github.repository == 'coado/react-native' steps: - uses: actions/checkout@v4 - name: Setup Node.js diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts index 2ac82083cbfec3..6befeb557b43d9 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -6109,13 +6109,13 @@ export { ScrollViewProps, // 27986ff5 ScrollViewPropsAndroid, // 84e2134b ScrollViewPropsIOS, // d83c9733 - ScrollViewScrollToOptions, // 3313411e + ScrollViewScrollToOptions, // 33134111 SectionBase, // b376bddc SectionList, // ff1193b2 SectionListData, // 119baf83 SectionListProps, // c9ac8e07 SectionListRenderItem, // 1fad0435 - SectionListRenderItemInfo, // 745e1992 + SectionListRenderItemInfo, // 745e1995 Separators, // 6a45f7e3 Settings, // 4282b0da Share, // e4591b32 diff --git a/private/react-native-bots/dangerfile.js b/private/react-native-bots/dangerfile.js index 1bff20819a9709..07a4a921e56682 100644 --- a/private/react-native-bots/dangerfile.js +++ b/private/react-native-bots/dangerfile.js @@ -30,23 +30,22 @@ const isFromPhabricator = body_contains('differential revision:'); // Provides advice if a summary section is missing, or body is too short const includesSummary = body_contains('## summary', 'summary:'); -const snapshot_output = JSON.parse( - fs.readFileSync( - path.join( - process.env.RUNNER_TEMP, - 'diff-js-api-breaking-changes/output.json', - ), - 'utf8', - ), +const snapshot_path = path.join( + process.env.RUNNER_TEMP, + 'diff-js-api-breaking-changes/output.json', ); -if (snapshot_output && snapshot_output.result !== 'NON_BREAKING') { - const title = ':exclamation: JavaScript API change detected'; - const idea = - 'This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API. ' + - 'Please include a clear changelog message. ' + - 'This change will be subject to extra review.\n\n' + - `This change was flagged as: ${snapshot_output.result}`; - warn(`${title} - ${idea}`); + +if (fs.existsSync(snapshot_path)) { + const snapshot_output = JSON.parse(fs.readFileSync(snapshot_path, 'utf8')); + if (snapshot_output && snapshot_output.result !== 'NON_BREAKING') { + const title = ':exclamation: JavaScript API change detected'; + const idea = + 'This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API. ' + + 'Please include a clear changelog message. ' + + 'This change will be subject to extra review.\n\n' + + `This change was flagged as: ${snapshot_output.result}`; + warn(`${title} - ${idea}`); + } } const hasNoUsefulBody =