Skip to content

Commit 72097f0

Browse files
huntiemeta-codesync[bot]
authored andcommitted
Remove repeat checkout step from diff-js-api-changes (fix CI) (#54865)
Summary: Pull Request resolved: #54865 Removes introduced in D88654826, replaced with a `git fetch` with `--depth`. This should fix CI runs on `main` (where we believe the extra checkout is clobbering the `yarn-install` step), and improve execution time. Also shorten action name. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D89044330 fbshipit-source-id: 690eb5c7db9490e5f160e933d64eae6ac21464c8
1 parent b7ca048 commit 72097f0

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

.github/actions/diff-js-api-breaking-changes/action.yml renamed to .github/actions/diff-js-api-changes/action.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
1-
name: diff-js-api-breaking-changes
1+
name: diff-js-api-changes
22
description: Check for breaking changes in the public React Native JS API
33
runs:
44
using: composite
55
steps:
6-
- name: Checkout PR branch
7-
uses: actions/checkout@v3
8-
with:
9-
fetch-depth: 0
10-
ref: ${{ github.event.pull_request.head.sha }}
11-
126
- name: Get merge base commit with main
137
id: merge_base
148
shell: bash
159
run: |
10+
git fetch origin main
11+
git fetch origin ${{ github.event.pull_request.head.sha }} --depth=100
1612
BASE=$(git merge-base ${{ github.event.pull_request.head.sha }} origin/main)
1713
echo "merge_base=$BASE" >> $GITHUB_OUTPUT
1814
1915
- name: Fetch snapshots from PR head and merge base
2016
shell: bash
2117
env:
22-
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
18+
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-changes
2319
run: |
2420
mkdir -p $SCRATCH_DIR
25-
# Fetch from PR head
26-
git show ${{ github.event.pull_request.head.sha }}:packages/react-native/ReactNativeApi.d.ts > $SCRATCH_DIR/ReactNativeApi-after.d.ts \
27-
|| echo "" > $SCRATCH_DIR/ReactNativeApi-after.d.ts
2821
# Fetch from merge base
2922
git show ${{ steps.merge_base.outputs.merge_base }}:packages/react-native/ReactNativeApi.d.ts > $SCRATCH_DIR/ReactNativeApi-before.d.ts \
3023
|| echo "" > $SCRATCH_DIR/ReactNativeApi-before.d.ts
24+
# Fetch from PR head
25+
git show ${{ github.event.pull_request.head.sha }}:packages/react-native/ReactNativeApi.d.ts > $SCRATCH_DIR/ReactNativeApi-after.d.ts \
26+
|| echo "" > $SCRATCH_DIR/ReactNativeApi-after.d.ts
3127
3228
- name: Run breaking change detection
3329
shell: bash
3430
env:
35-
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
31+
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-changes
3632
run: |
3733
node ./scripts/js-api/diff-api-snapshot \
3834
$SCRATCH_DIR/ReactNativeApi-before.d.ts \

.github/workflows/danger-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
uses: ./.github/actions/setup-node
2323
- name: Run yarn install
2424
uses: ./.github/actions/yarn-install
25-
- name: Run diff-js-api-breaking-changes
26-
uses: ./.github/actions/diff-js-api-breaking-changes
25+
- name: Run diff-js-api-changes
26+
uses: ./.github/actions/diff-js-api-changes
2727
- name: Danger
2828
run: yarn danger ci --use-github-checks --failOnErrors
2929
working-directory: private/react-native-bots

private/react-native-bots/dangerfile.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ const includesSummary = body_contains('## summary', 'summary:');
3232

3333
const snapshot_output = JSON.parse(
3434
fs.readFileSync(
35-
path.join(
36-
process.env.RUNNER_TEMP,
37-
'diff-js-api-breaking-changes/output.json',
38-
),
35+
path.join(process.env.RUNNER_TEMP, 'diff-js-api-changes/output.json'),
3936
'utf8',
4037
),
4138
);

0 commit comments

Comments
 (0)