Skip to content

Commit 7795192

Browse files
gh/actions: run benchmark and NPM diff on correct base commits (#3427)
Fixes #3371
1 parent 95a85f7 commit 7795192

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,14 @@ jobs:
166166
benchmark:
167167
name: Run benchmark
168168
runs-on: ubuntu-latest
169+
env:
170+
COMMITS_TO_TEST: ${{ github.event.pull_request.commits || 1 }}
169171
steps:
170172
- name: Checkout repo
171173
uses: actions/checkout@v2
172-
with:
173-
fetch-depth: 2
174+
175+
- name: Deepen cloned repo
176+
run: 'git fetch --deepen=$COMMITS_TO_TEST'
174177

175178
- name: Setup Node.js
176179
uses: actions/setup-node@v2
@@ -182,16 +185,19 @@ jobs:
182185
run: npm ci --ignore-scripts
183186

184187
- name: Run Benchmark
185-
run: 'npm run benchmark -- --revs HEAD HEAD~1'
188+
run: 'npm run benchmark -- --revs HEAD "HEAD~$COMMITS_TO_TEST"'
186189

187190
diff-npm-package:
188191
name: Diff content of NPM package
189192
runs-on: ubuntu-latest
193+
env:
194+
COMMITS_TO_TEST: ${{ github.event.pull_request.commits || 1 }}
190195
steps:
191196
- name: Checkout repo
192197
uses: actions/checkout@v2
193-
with:
194-
fetch-depth: 2
198+
199+
- name: Deepen cloned repo
200+
run: 'git fetch --deepen=$COMMITS_TO_TEST'
195201

196202
- name: Setup Node.js
197203
uses: actions/setup-node@v2
@@ -203,9 +209,7 @@ jobs:
203209
run: npm ci --ignore-scripts
204210

205211
- name: Generate report
206-
run: 'node resources/diff-npm-package.js $BASE_COMMIT HEAD'
207-
env:
208-
BASE_COMMIT: ${{ github.event.pull_request.base.sha || 'HEAD~1' }}
212+
run: 'node resources/diff-npm-package.js HEAD~$COMMITS_TO_TEST HEAD'
209213

210214
- name: Upload generated report
211215
uses: actions/upload-artifact@v2

0 commit comments

Comments
 (0)