Skip to content

Commit

Permalink
Dangerfile exits early if build failed (facebook#14400)
Browse files Browse the repository at this point in the history
* Dangerfile exits early (without leaving an error comment) if build failed
  • Loading branch information
bvaughn authored Dec 7, 2018
1 parent 8df4d59 commit f64906f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//
// You'll need a GitHub token, you can re-use this one:
//
// e622517d9f1136ea8900 07c6373666312cdfaa69
// 0a7d5c3cad9a6dbec2d9 9a5222cf49062a4c1ef7
//
// (Just remove the space)
//
Expand All @@ -29,9 +29,16 @@ const {markdown, danger} = require('danger');
const fetch = require('node-fetch');

const {generateResultsArray} = require('./scripts/rollup/stats');
const {readFileSync} = require('fs');
const {existsSync, readFileSync} = require('fs');
const {exec} = require('child_process');

if (!existsSync('./scripts/rollup/results.json')) {
// This indicates the build failed previously.
// In that case, there's nothing for the Dangerfile to do.
// Exit early to avoid leaving a redundant (and potentially confusing) PR comment.
process.exit(0);
}

const currentBuildResults = JSON.parse(
readFileSync('./scripts/rollup/results.json')
);
Expand Down

0 comments on commit f64906f

Please sign in to comment.