Skip to content

Commit

Permalink
[New] Exit with nonzero code on unmergeable
Browse files Browse the repository at this point in the history
  • Loading branch information
Green-Ranger11 authored and ljharb committed Nov 7, 2021
1 parent d9f4508 commit c28af03
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/can-merge
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const runQuery = require('../utils/runQuery');
const evaluatePullRequest = require('../utils/evaluatePullRequest');
const logger = require('../utils/logger');
const parsePullRequest = require('../utils/parsePullRequest');
const pullRequestStatus = require('../utils/models/pullRequestStatus');

const {
GITHUB_TOKEN,
Expand Down Expand Up @@ -64,7 +65,11 @@ runQuery(args.repo, args.pr, token).then((response) => {
process.exitCode = 1;
} else {
prs.forEach((pr) => {
console.info('PR:', pr.number, logger(evaluatePullRequest(pr)));
const status = evaluatePullRequest(pr);
console.info('PR:', pr.number, logger(status));
if (status !== pullRequestStatus.MERGEABLE) {
process.exitCode = (process.exitCode ?? 0) + 1;
}
});
}
});
Expand Down

0 comments on commit c28af03

Please sign in to comment.