Skip to content

Commit

Permalink
fix: deduct pr remaining when automerging comment
Browse files Browse the repository at this point in the history
Closes #6266
  • Loading branch information
rarkins committed May 17, 2020
1 parent 32725d2 commit d03b7e6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/workers/repository/process/write.ts
Expand Up @@ -28,6 +28,7 @@ export async function writeUpdates(
return true;
});
let prsRemaining = await getPrsRemaining(config, branches);
logger.debug({ prsRemaining }, 'Calculated maximum PRs remaining this run');
for (const branch of branches) {
addMeta({ branch: branch.branchName });
const res = await processBranch(
Expand All @@ -39,7 +40,19 @@ export async function writeUpdates(
// Stop procesing other branches because base branch has been changed
return res;
}
prsRemaining -= res === 'pr-created' ? 1 : 0;
let deductPrRemainingCount = 0;
if (res === 'pr-created') {
deductPrRemainingCount = 1;
}
// istanbul ignore if
if (
res === 'automerged' &&
config.automergeType === 'pr-comment' &&
config.requiredStatusChecks === null
) {
deductPrRemainingCount = 1;
}
prsRemaining -= deductPrRemainingCount;
}
removeMeta(['branch']);
return 'done';
Expand Down

0 comments on commit d03b7e6

Please sign in to comment.