Skip to content

Commit

Permalink
Don't run danger on bad build (facebook#14143)
Browse files Browse the repository at this point in the history
sizebot comments can be confusing when not based on reality.

If results.json doesn't exist, danger will fail. This is what we want.
  • Loading branch information
sophiebits authored Nov 9, 2018
1 parent 1034e26 commit 9cc631a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions scripts/circleci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ set -e
# the merge base by Dangerfile instead. See https://github.com/facebook/react/pull/12606.
if [ -z "$CI_PULL_REQUEST" ]; then
curl -o scripts/rollup/results.json http://react.zpao.com/builds/master/latest/results.json
else
# If build fails, cause danger to fail/abort too
rm scripts/rollup/results.json
fi

yarn build --extract-errors
Expand Down
4 changes: 3 additions & 1 deletion scripts/rollup/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const filesize = require('filesize');
const chalk = require('chalk');
const join = require('path').join;
const fs = require('fs');
const prevBuildResults = require('./results.json');
const prevBuildResults = fs.existsSync(__dirname + '/results.json')
? require('./results.json')
: {bundleSizes: []};

const currentBuildResults = {
// Mutated inside build.js during a build run.
Expand Down

0 comments on commit 9cc631a

Please sign in to comment.