Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions/diff-js-api-breaking-changes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
31 changes: 15 additions & 16 deletions private/react-native-bots/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: <code>${snapshot_output.result}</code>`;
warn(`${title} - <i>${idea}</i>`);

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&#39;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: <code>${snapshot_output.result}</code>`;
warn(`${title} - <i>${idea}</i>`);
}
}

const hasNoUsefulBody =
Expand Down