Skip to content

Commit

Permalink
fix(worker): wrong no branch delete on dry-run (#9682)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Apr 22, 2021
1 parent 43907c1 commit e0488a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/workers/branch/index.spec.ts
Expand Up @@ -372,6 +372,7 @@ describe(getName(__filename), () => {
await branchWorker.processBranch(config);
expect(automerge.tryBranchAutomerge).toHaveBeenCalledTimes(1);
expect(prWorker.ensurePr).toHaveBeenCalledTimes(0);
expect(git.deleteBranch).toHaveBeenCalledTimes(0);
});
it('returns if branch exists and prCreation set to approval', async () => {
getUpdated.getUpdatedPackageFiles.mockResolvedValueOnce({
Expand Down
6 changes: 5 additions & 1 deletion lib/workers/branch/index.ts
Expand Up @@ -372,7 +372,11 @@ export async function processBranch(
const mergeStatus = await tryBranchAutomerge(config);
logger.debug(`mergeStatus=${mergeStatus}`);
if (mergeStatus === 'automerged') {
await deleteBranchSilently(config.branchName);
if (getAdminConfig().dryRun) {
logger.info('DRY-RUN: Would delete branch' + config.branchName);
} else {
await deleteBranchSilently(config.branchName);
}
logger.debug('Branch is automerged - returning');
return { branchExists: false, result: BranchResult.Automerged };
}
Expand Down

0 comments on commit e0488a3

Please sign in to comment.