Skip to content

Commit

Permalink
fix(automerge): check branch status again before automerge
Browse files Browse the repository at this point in the history
Catches an edge case where a PR is configured for automerge and a new update comes right before automerge. If branch protection wasn’t configured, Renovate was using a “stale” branch status to think it’s OK to merge. Added an additional check before automerging that should catch it.

Fixes #3099
  • Loading branch information
rarkins committed Jan 22, 2019
1 parent 372bfeb commit e578bff
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/workers/pr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ async function ensurePr(prConfig) {
branchName,
config.requiredStatusChecks
);
logger.debug({ branchStatus, branchName }, 'getBranchStatus() result');
}
return branchStatus;
}
Expand Down Expand Up @@ -388,6 +389,16 @@ async function checkAutoMerge(pr, config) {
logger.info('PR is not ready for merge');
return false;
}
const branchStatus = await platform.getBranchStatus(
branchName,
requiredStatusChecks
);
if (branchStatus !== 'success') {
logger.info(
`PR is not ready for merge (branch status is ${branchStatus})`
);
return false;
}
// Check if it's been touched
if (!pr.canRebase) {
logger.info('PR is ready for automerge but has been modified');
Expand Down

0 comments on commit e578bff

Please sign in to comment.