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
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
name: diff-js-api-breaking-changes
name: diff-js-api-changes
description: Check for breaking changes in the public React Native JS API
runs:
using: composite
steps:
- name: Checkout PR branch
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Get merge base commit with main
id: merge_base
shell: bash
id: merge_base
run: |
git fetch origin main
git fetch origin ${{ github.event.pull_request.head.sha }} --depth=100
BASE=$(git merge-base ${{ github.event.pull_request.head.sha }} origin/main)
echo "merge_base=$BASE" >> $GITHUB_OUTPUT

- name: Fetch snapshots from PR head and merge base
shell: bash
env:
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-changes
run: |
mkdir -p $SCRATCH_DIR
# Fetch from PR head
git show ${{ github.event.pull_request.head.sha }}:packages/react-native/ReactNativeApi.d.ts > $SCRATCH_DIR/ReactNativeApi-after.d.ts \
|| echo "" > $SCRATCH_DIR/ReactNativeApi-after.d.ts
# Fetch from merge base
git show ${{ steps.merge_base.outputs.merge_base }}:packages/react-native/ReactNativeApi.d.ts > $SCRATCH_DIR/ReactNativeApi-before.d.ts \
|| echo "" > $SCRATCH_DIR/ReactNativeApi-before.d.ts
# Fetch from PR head
git show ${{ github.event.pull_request.head.sha }}:packages/react-native/ReactNativeApi.d.ts > $SCRATCH_DIR/ReactNativeApi-after.d.ts \
|| echo "" > $SCRATCH_DIR/ReactNativeApi-after.d.ts

- name: Run breaking change detection
shell: bash
env:
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-changes
run: |
node ./scripts/js-api/diff-api-snapshot \
$SCRATCH_DIR/ReactNativeApi-before.d.ts \
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/danger-pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Run Danger on PR

on:
pull_request_target:
pull_request:
types: [opened, edited, reopened, synchronize]

permissions:
Expand All @@ -15,17 +15,17 @@ 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
uses: ./.github/actions/setup-node
- name: Run yarn install
uses: ./.github/actions/yarn-install
- name: Run diff-js-api-breaking-changes
uses: ./.github/actions/diff-js-api-breaking-changes
- name: Danger
run: yarn danger ci --use-github-checks --failOnErrors
working-directory: private/react-native-bots
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
- name: Run diff-js-api-changes
uses: ./.github/actions/diff-js-api-changes
# - name: Danger
# run: yarn danger ci --use-github-checks --failOnErrors
# working-directory: private/react-native-bots
# env:
# DANGER_GITHUB_API_TOKEN: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
5 changes: 1 addition & 4 deletions private/react-native-bots/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ 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',
),
path.join(process.env.RUNNER_TEMP, 'diff-js-api-changes/output.json'),
'utf8',
),
);
Expand Down
Loading