diff --git a/lib/workers/repository/update/branch/index.spec.ts b/lib/workers/repository/update/branch/index.spec.ts index 9652a2439c06e4805535c09f45187205333b6521..a54172896054390a6330090cc52ebb2effb09d68 100644 --- a/lib/workers/repository/update/branch/index.spec.ts +++ b/lib/workers/repository/update/branch/index.spec.ts @@ -940,6 +940,10 @@ describe('workers/repository/update/branch/index', () => { prNo: undefined, result: 'pr-edited', }); + expect(logger.info).toHaveBeenCalledWith( + `DRY-RUN: Would update existing PR to indicate that rebasing is not possible` + ); + expect(platform.updatePr).toHaveBeenCalledTimes(0); }); it('branch pr no schedule lockfile (dry run)', async () => { diff --git a/lib/workers/repository/update/branch/index.ts b/lib/workers/repository/update/branch/index.ts index d2d2bfe6cede900d91923faf3e77a26ef204e322..53f1ef2cf9f1e0016dc53331df9800c6b3347aa6 100644 --- a/lib/workers/repository/update/branch/index.ts +++ b/lib/workers/repository/update/branch/index.ts @@ -198,15 +198,21 @@ export async function processBranch( }); const newBodyHash = hashBody(newBody); if (newBodyHash !== branchPr.bodyStruct?.hash) { - logger.debug( - 'Updating existing PR to indicate that rebasing is not possible' - ); - await platform.updatePr({ - number: branchPr.number, - prTitle: branchPr.title, - prBody: newBody, - platformOptions: getPlatformPrOptions(config), - }); + if (GlobalConfig.get('dryRun')) { + logger.info( + `DRY-RUN: Would update existing PR to indicate that rebasing is not possible` + ); + } else { + logger.debug( + 'Updating existing PR to indicate that rebasing is not possible' + ); + await platform.updatePr({ + number: branchPr.number, + prTitle: branchPr.title, + prBody: newBody, + platformOptions: getPlatformPrOptions(config), + }); + } } return { branchExists,