Skip to content
Snippets Groups Projects
Commit 93b13b55 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

feat(onboarding): Allow branch cleanup after onboarding (#477)

Refactored location of branch cleanup so that it can be run even if onboarding is enabled.
This means someone can “undo” a closed Configure Renovate and all other PRs would get cleaned up.
parent 58d66a21
Branches
Tags v9.17.0
No related merge requests found
...@@ -77,6 +77,7 @@ async function renovateRepository(packageFileConfig) { ...@@ -77,6 +77,7 @@ async function renovateRepository(packageFileConfig) {
const branchUpgrades = res.upgrades; const branchUpgrades = res.upgrades;
config.logger.debug(`Updating ${branchUpgrades.length} branch(es)`); config.logger.debug(`Updating ${branchUpgrades.length} branch(es)`);
config.logger.trace({ config: branchUpgrades }, 'branchUpgrades'); config.logger.trace({ config: branchUpgrades }, 'branchUpgrades');
let branchList;
if (config.repoIsOnboarded) { if (config.repoIsOnboarded) {
for (const branchUpgrade of branchUpgrades) { for (const branchUpgrade of branchUpgrades) {
await branchWorker.processBranchUpgrades( await branchWorker.processBranchUpgrades(
...@@ -85,13 +86,15 @@ async function renovateRepository(packageFileConfig) { ...@@ -85,13 +86,15 @@ async function renovateRepository(packageFileConfig) {
config.warnings config.warnings
); );
} }
const branchList = branchUpgrades.map(upgrade => upgrade.branchName); branchList = branchUpgrades.map(upgrade => upgrade.branchName);
config.logger.debug(`branchList=${branchList}`); config.logger.debug(`branchList=${branchList}`);
await cleanup.pruneStaleBranches(config, branchList); await cleanup.pruneStaleBranches(config, branchList);
} else { } else {
await onboarding.ensurePr(config, branchUpgrades); await onboarding.ensurePr(config, branchUpgrades);
config.logger.info('"Configure Renovate" PR needs to be closed first'); config.logger.info('"Configure Renovate" PR needs to be closed first');
branchList = ['renovate/configure'];
} }
await cleanup.pruneStaleBranches(config, branchList);
} catch (error) { } catch (error) {
// Swallow this error so that other repositories can be processed // Swallow this error so that other repositories can be processed
config.logger.error(`Failed to process repository: ${error.message}`); config.logger.error(`Failed to process repository: ${error.message}`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment