Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9cc631a

Browse files
authored
Don't run danger on bad build (facebook#14143)
sizebot comments can be confusing when not based on reality. If results.json doesn't exist, danger will fail. This is what we want.
1 parent 1034e26 commit 9cc631a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

scripts/circleci/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ set -e
88
# the merge base by Dangerfile instead. See https://github.com/facebook/react/pull/12606.
99
if [ -z "$CI_PULL_REQUEST" ]; then
1010
curl -o scripts/rollup/results.json http://react.zpao.com/builds/master/latest/results.json
11+
else
12+
# If build fails, cause danger to fail/abort too
13+
rm scripts/rollup/results.json
1114
fi
1215

1316
yarn build --extract-errors

scripts/rollup/stats.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ const filesize = require('filesize');
55
const chalk = require('chalk');
66
const join = require('path').join;
77
const fs = require('fs');
8-
const prevBuildResults = require('./results.json');
8+
const prevBuildResults = fs.existsSync(__dirname + '/results.json')
9+
? require('./results.json')
10+
: {bundleSizes: []};
911

1012
const currentBuildResults = {
1113
// Mutated inside build.js during a build run.

0 commit comments

Comments
 (0)