mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Add api-changes.yml workflow to replace danger-pr (#55341)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55341 Changelog: [INTERNAL] [CHANGED] - Add api-changes.yml workflow to replace danger-pr for detecting changes in the js api The workflow: - Triggers on `pull_request_target` for opened, edited, reopened, and synchronize events - Checks out the main branch (for security, using trusted code) - Runs the `diff-js-api-changes` action to detect API changes - Posts a PR comment using the generic `post-pr-comment` action The PR comment script creates, updates, or deletes a bot comment based on whether there are any sections to report, using a marker to identify existing bot comments. Reviewed By: huntie Differential Revision: D90991845 fbshipit-source-id: 753475a7c24df8bc581b2ab47bfad1f5551c823c
This commit is contained in:
1 parent
10709f427d
commit
6a9d792f9a
3 files changed
+119
No files matched your search
@@ -1,5 +1,9 @@
|
||||
name: diff-js-api-changes
|
||||
description: Check for breaking changes in the public React Native JS API
|
||||
outputs:
|
||||
message:
|
||||
description: Formatted markdown message describing API changes, or empty if no changes
|
||||
value: ${{ steps.format_output.outputs.message }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
@@ -35,3 +39,35 @@ runs:
|
||||
$SCRATCH_DIR/ReactNativeApi-before.d.ts \
|
||||
$SCRATCH_DIR/ReactNativeApi-after.d.ts \
|
||||
> $SCRATCH_DIR/output.json
|
||||
|
||||
- name: Format output message
|
||||
id: format_output
|
||||
shell: bash
|
||||
env:
|
||||
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-changes
|
||||
run: |
|
||||
if [ ! -f "$SCRATCH_DIR/output.json" ]; then
|
||||
echo "message=" >> $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RESULT=$(cat $SCRATCH_DIR/output.json | jq -r '.result // empty')
|
||||
if [ -z "$RESULT" ] || [ "$RESULT" = "NON_BREAKING" ]; then
|
||||
echo "message=" >> $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Use delimiter for multiline output
|
||||
{
|
||||
echo "message<<EOF"
|
||||
echo "> [!WARNING]"
|
||||
echo "> **JavaScript API change detected**"
|
||||
echo ">"
|
||||
echo "> This PR commits an update to \`ReactNativeApi.d.ts\`, indicating a change to React Native's public JavaScript API."
|
||||
echo ">"
|
||||
echo "> - Please include a **clear changelog message**."
|
||||
echo "> - This change will be subject to additional review."
|
||||
echo ">"
|
||||
echo "> This change was flagged as: \`${RESULT}\`"
|
||||
echo "EOF"
|
||||
} >> $GITHUB_OUTPUT
|
||||
Reference in new issue
Block a user