@samitouri / QOS-React / commits / 9cc631a539

Don't run danger on bad build (#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.

Sophie Alpert committed Nov 9, 2018 at 10:21 UTC 9cc631a539a33fdadcba2902b87975acbcd58402
2 files changed +6 -1
scripts/circleci/build.sh
+3
@@ -8,6 +8,9 @@ set -e
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 +else
12 + # If build fails, cause danger to fail/abort too
13 + rm scripts/rollup/results.json
14 fi
15
16 yarn build --extract-errors
scripts/rollup/stats.js
+3 -1
@@ -5,7 +5,9 @@ const filesize = require('filesize');
5 const chalk = require('chalk');
6 const join = require('path').join;
7 const fs = require('fs');
8 -const prevBuildResults = require('./results.json');
8 +const prevBuildResults = fs.existsSync(__dirname + '/results.json')
9 + ? require('./results.json')
10 + : {bundleSizes: []};
11
12 const currentBuildResults = {
13 // Mutated inside build.js during a build run.