Skip to content

Commit c27a998

Browse files
authored
[Danger] Minor fixes (#12606)
* Don't download bundle stats from master on CI This was temporarily necessary in the past because we didn't have the logic that downloads actual *merge base* stats. We do have that now as part of the Danger script. So we can remove this. * Use absolute threshold for whether to show a change * Download master stats, but only for other master builds * Rewrite sizes
1 parent 915bb53 commit c27a998

File tree

4 files changed

+192
-175
lines changed

4 files changed

+192
-175
lines changed

dangerfile.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,12 @@ function git(args) {
117117
previousBuildResults
118118
);
119119

120-
const percentToWarrentShowing = 1;
121120
const packagesToShow = results
122121
.filter(
123122
r =>
124-
Math.abs(r.prevFileSizeChange) >= percentToWarrentShowing ||
125-
Math.abs(r.prevGzipSizeChange) >= percentToWarrentShowing
123+
Math.abs(r.prevFileSizeAbsoluteChange) >= 300 || // bytes
124+
Math.abs(r.prevGzipSizeAbsoluteChange) >= 100 // bytes
126125
)
127-
128126
.map(r => r.packageName);
129127

130128
if (packagesToShow.length) {

scripts/circleci/build.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
set -e
44

5-
# Update the local size measurements to the master version
6-
# so that the size diff printed at the end of the build is
7-
# accurate.
8-
curl -o scripts/rollup/results.json http://react.zpao.com/builds/master/latest/results.json
5+
# On master, download the bundle sizes from last master build so that
6+
# the size printed in the CI logs for master commits is accurate.
7+
# We don't do it for pull requests because those are compared against
8+
# the merge base by Dangerfile instead. See https://github.com/facebook/react/pull/12606.
9+
if [ -z "$CI_PULL_REQUEST" ]; then
10+
curl -o scripts/rollup/results.json http://react.zpao.com/builds/master/latest/results.json
11+
fi
912

1013
yarn build --extract-errors
1114
# Note: since we run the full build including extracting error codes,

0 commit comments

Comments
 (0)