fix: move rebaseWhen=never check earlier (#13218)

This commit is contained in:
Rhys Arkins 2021-12-21 21:23:08 +01:00 committed by GitHub
parent 0606cc82f9
commit 347d7dc51f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 24 deletions

View file

@ -338,13 +338,21 @@ export async function processBranch(
}
}
// istanbul ignore if
if (
const userRebaseRequested =
dependencyDashboardCheck === 'rebase' ||
config.dependencyDashboardRebaseAllOpen
) {
config.dependencyDashboardRebaseAllOpen ||
config.rebaseRequested;
if (userRebaseRequested) {
logger.debug('Manual rebase requested via Dependency Dashboard');
config.reuseExistingBranch = false;
} else if (branchExists && config.rebaseWhen === 'never') {
logger.debug('rebaseWhen=never so skipping branch update check');
return {
branchExists,
prNo: branchPr?.number,
result: BranchResult.NoWork,
};
} else {
config = { ...config, ...(await shouldReuseExistingBranch(config)) };
}
@ -430,16 +438,7 @@ export async function processBranch(
});
}
}
const forcedManually =
!!dependencyDashboardCheck || config.rebaseRequested || !branchExists;
if (!forcedManually && config.rebaseWhen === 'never') {
logger.debug(`Skipping commit (rebaseWhen=never)`);
return {
branchExists,
prNo: branchPr?.number,
result: BranchResult.NoWork,
};
}
const forcedManually = userRebaseRequested || !branchExists;
config.forceCommit = forcedManually || branchPr?.isConflicted;
const commitSha = await commitFilesToBranch(config);
// istanbul ignore if
@ -466,8 +465,7 @@ export async function processBranch(
// but do not break when there are artifact errors
if (
!config.artifactErrors?.length &&
!dependencyDashboardCheck &&
!config.rebaseRequested &&
!userRebaseRequested &&
commitSha &&
config.prCreation !== 'immediate'
) {

View file

@ -271,14 +271,6 @@ export async function ensureDependencyDashboard(
issueBody += '## Other Branches\n\n';
issueBody += `These updates are pending. To force PRs open, click the checkbox below.\n\n`;
for (const branch of otherBranches) {
logger.info(
{
prBlockedBy: branch.prBlockedBy,
prNo: branch.prNo,
result: branch.result,
},
'Blocked PR'
);
issueBody += getListItem(branch, 'other');
}
issueBody += '\n';