From 9147c13af1810d000aeb89f2232c978ec0e7c50b Mon Sep 17 00:00:00 2001 From: Dawid Malecki Date: Tue, 16 Sep 2025 14:55:56 +0200 Subject: [PATCH 1/4] test danger --- .github/workflows/danger-pr.yml | 2 +- packages/react-native/ReactNativeApi.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/danger-pr.yml b/.github/workflows/danger-pr.yml index cf28b788105a..06daf7ee8378 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 058b47d8d864..9cbbeab20a35 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -60,7 +60,7 @@ declare const $$AnimatedImplementation: { timing: typeof timingImpl unforkEvent: typeof unforkEventImpl Value: typeof AnimatedValue_default - ValueXY: typeof AnimatedValueXY_default + // ValueXY: typeof AnimatedValueXY_default } declare const $$AnimatedScrollView: typeof AnimatedScrollView_default declare const $$AnimatedSectionList: ( From d6fcc3d96b8e973aceccd2a1edd31bb834e75210 Mon Sep 17 00:00:00 2001 From: Dawid Malecki Date: Tue, 16 Sep 2025 15:27:32 +0200 Subject: [PATCH 2/4] comment gh repo --- .github/workflows/danger-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/danger-pr.yml b/.github/workflows/danger-pr.yml index 06daf7ee8378..a777d9aa4e8d 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 == 'coado/react-native' + # if: github.repository == 'coado/react-native' steps: - uses: actions/checkout@v4 - name: Setup Node.js From 060aaeba6248950f3215d3a4eb13f8ad171f1d38 Mon Sep 17 00:00:00 2001 From: Dawid Malecki Date: Tue, 16 Sep 2025 15:38:24 +0200 Subject: [PATCH 3/4] pull request --- .github/workflows/danger-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/danger-pr.yml b/.github/workflows/danger-pr.yml index a777d9aa4e8d..c1331def63d9 100644 --- a/.github/workflows/danger-pr.yml +++ b/.github/workflows/danger-pr.yml @@ -1,7 +1,7 @@ name: Run Danger on PR on: - pull_request_target: + pull_request: types: [opened, edited, reopened, synchronize] permissions: From d7f3dfb7f886797e361b00b13cf071d5b7f09215 Mon Sep 17 00:00:00 2001 From: Dawid Malecki Date: Tue, 16 Sep 2025 15:59:37 +0200 Subject: [PATCH 4/4] test --- .../diff-js-api-breaking-changes/action.yml | 2 ++ .github/workflows/danger-pr.yml | 4 +-- packages/react-native/ReactNativeApi.d.ts | 2 +- private/react-native-bots/dangerfile.js | 31 +++++++++---------- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/actions/diff-js-api-breaking-changes/action.yml b/.github/actions/diff-js-api-breaking-changes/action.yml index bc45b1b207aa..a55bbd2f83e0 100644 --- a/.github/actions/diff-js-api-breaking-changes/action.yml +++ b/.github/actions/diff-js-api-breaking-changes/action.yml @@ -17,6 +17,8 @@ runs: env: SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes run: | + 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 c1331def63d9..cf28b788105a 100644 --- a/.github/workflows/danger-pr.yml +++ b/.github/workflows/danger-pr.yml @@ -1,7 +1,7 @@ name: Run Danger on PR on: - pull_request: + pull_request_target: types: [opened, edited, reopened, synchronize] permissions: @@ -15,7 +15,7 @@ permissions: jobs: danger: runs-on: ubuntu-latest - # if: github.repository == 'coado/react-native' + if: github.repository == 'facebook/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 9cbbeab20a35..058b47d8d864 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -60,7 +60,7 @@ declare const $$AnimatedImplementation: { timing: typeof timingImpl unforkEvent: typeof unforkEventImpl Value: typeof AnimatedValue_default - // ValueXY: typeof AnimatedValueXY_default + ValueXY: typeof AnimatedValueXY_default } declare const $$AnimatedScrollView: typeof AnimatedScrollView_default declare const $$AnimatedSectionList: ( diff --git a/private/react-native-bots/dangerfile.js b/private/react-native-bots/dangerfile.js index 1bff20819a97..07a4a921e566 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 =