Skip to content
Snippets Groups Projects
Commit d03b7e61 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: deduct pr remaining when automerging comment

Closes #6266
parent 32725d23
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ export async function writeUpdates( ...@@ -28,6 +28,7 @@ export async function writeUpdates(
return true; return true;
}); });
let prsRemaining = await getPrsRemaining(config, branches); let prsRemaining = await getPrsRemaining(config, branches);
logger.debug({ prsRemaining }, 'Calculated maximum PRs remaining this run');
for (const branch of branches) { for (const branch of branches) {
addMeta({ branch: branch.branchName }); addMeta({ branch: branch.branchName });
const res = await processBranch( const res = await processBranch(
...@@ -39,7 +40,19 @@ export async function writeUpdates( ...@@ -39,7 +40,19 @@ export async function writeUpdates(
// Stop procesing other branches because base branch has been changed // Stop procesing other branches because base branch has been changed
return res; 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']); removeMeta(['branch']);
return 'done'; return 'done';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment