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

View file

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