diff --git a/lib/modules/platform/azure/__snapshots__/index.spec.ts.snap b/lib/modules/platform/azure/__snapshots__/index.spec.ts.snap index 3be9ce9411245c3..f6351cf80ddb1b6 100644 --- a/lib/modules/platform/azure/__snapshots__/index.spec.ts.snap +++ b/lib/modules/platform/azure/__snapshots__/index.spec.ts.snap @@ -280,6 +280,7 @@ exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOption { "description": "Hello world again", "status": 2, + "targetRefName": "refs/heads/target_branch", "title": "The New Title", }, "1", @@ -295,6 +296,7 @@ exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOption [ { "status": 1, + "targetRefName": "refs/heads/target_branch", }, "1", 1234, @@ -302,6 +304,7 @@ exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOption [ { "description": "Hello world again", + "targetRefName": "refs/heads/target_branch", "title": "The New Title", }, "1", @@ -315,6 +318,7 @@ exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOption [ { "description": "Hello world again", + "targetRefName": "refs/heads/target_branch", "title": "The New Title", }, "1", @@ -327,6 +331,7 @@ exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOption [ [ { + "targetRefName": "refs/heads/target_branch", "title": "The New Title - autoclose", }, "1", diff --git a/lib/modules/platform/azure/index.spec.ts b/lib/modules/platform/azure/index.spec.ts index 29493cd24212171..308da75ced5e326 100644 --- a/lib/modules/platform/azure/index.spec.ts +++ b/lib/modules/platform/azure/index.spec.ts @@ -826,6 +826,7 @@ describe('modules/platform/azure/index', () => { number: 1234, prTitle: 'The New Title', prBody: 'Hello world again', + targetBranch: 'target_branch', }); expect(updatePullRequest.mock.calls).toMatchSnapshot(); }); @@ -842,6 +843,7 @@ describe('modules/platform/azure/index', () => { await azure.updatePr({ number: 1234, prTitle: 'The New Title - autoclose', + targetBranch: 'target_branch', }); expect(updatePullRequest.mock.calls).toMatchSnapshot(); }); @@ -860,6 +862,7 @@ describe('modules/platform/azure/index', () => { prTitle: 'The New Title', prBody: 'Hello world again', state: 'closed', + targetBranch: 'target_branch', }); expect(updatePullRequest.mock.calls).toMatchSnapshot(); }); @@ -878,6 +881,7 @@ describe('modules/platform/azure/index', () => { prTitle: 'The New Title', prBody: 'Hello world again', state: 'open', + targetBranch: 'target_branch', }); expect(updatePullRequest.mock.calls).toMatchSnapshot(); }); diff --git a/lib/modules/platform/azure/index.ts b/lib/modules/platform/azure/index.ts index def6948ea10b12c..b07179a9ac86e52 100644 --- a/lib/modules/platform/azure/index.ts +++ b/lib/modules/platform/azure/index.ts @@ -508,13 +508,16 @@ export async function updatePr({ prTitle: title, prBody: body, state, + targetBranch, platformOptions, }: UpdatePrConfig): Promise { logger.debug(`updatePr(${prNo}, ${title}, body)`); const azureApiGit = await azureApi.gitApi(); + const targetRefName = getNewBranchName(targetBranch); const objToUpdate: GitPullRequest = { title, + targetRefName, }; if (body) { @@ -523,7 +526,7 @@ export async function updatePr({ if (state === 'open') { await azureApiGit.updatePullRequest( - { status: PullRequestStatus.Active }, + { status: PullRequestStatus.Active, targetRefName }, config.repoId, prNo ); diff --git a/lib/modules/platform/bitbucket-server/index.spec.ts b/lib/modules/platform/bitbucket-server/index.spec.ts index 763d837ecf1220b..0b427a1dc66d385 100644 --- a/lib/modules/platform/bitbucket-server/index.spec.ts +++ b/lib/modules/platform/bitbucket-server/index.spec.ts @@ -1417,6 +1417,7 @@ describe('modules/platform/bitbucket-server/index', () => { number: 5, prTitle: 'title', prBody: 'body', + targetBranch: 'target_branch', }) ).toResolve(); }); @@ -1443,6 +1444,7 @@ describe('modules/platform/bitbucket-server/index', () => { prTitle: 'title', prBody: 'body', state: 'closed', + targetBranch: 'target_branch', }) ).toResolve(); }); @@ -1469,6 +1471,7 @@ describe('modules/platform/bitbucket-server/index', () => { prTitle: 'title', prBody: 'body', state: 'open', + targetBranch: 'target_branch', }) ).toResolve(); }); @@ -1480,6 +1483,7 @@ describe('modules/platform/bitbucket-server/index', () => { number: null as any, prTitle: 'title', prBody: 'body', + targetBranch: 'target_branch', }) ).rejects.toThrow(REPOSITORY_NOT_FOUND); }); @@ -1492,7 +1496,12 @@ describe('modules/platform/bitbucket-server/index', () => { ) .reply(404); await expect( - bitbucket.updatePr({ number: 4, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 4, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).rejects.toThrow(REPOSITORY_NOT_FOUND); }); @@ -1509,7 +1518,12 @@ describe('modules/platform/bitbucket-server/index', () => { .reply(404); await expect( - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).rejects.toThrow(REPOSITORY_NOT_FOUND); }); @@ -1558,6 +1572,7 @@ describe('modules/platform/bitbucket-server/index', () => { prTitle: 'title', prBody: 'body', state: 'open', + targetBranch: 'target_branch', }) ).toResolve(); }); @@ -1575,7 +1590,12 @@ describe('modules/platform/bitbucket-server/index', () => { .reply(409); await expect( - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).rejects.toThrow(REPOSITORY_CHANGED); }); @@ -1592,7 +1612,12 @@ describe('modules/platform/bitbucket-server/index', () => { .reply(405); await expect( - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).rejects.toThrowErrorMatchingSnapshot(); }); }); diff --git a/lib/modules/platform/bitbucket-server/index.ts b/lib/modules/platform/bitbucket-server/index.ts index 43c44bf84c21eaa..10db54d3781036a 100644 --- a/lib/modules/platform/bitbucket-server/index.ts +++ b/lib/modules/platform/bitbucket-server/index.ts @@ -851,6 +851,7 @@ export async function updatePr({ prBody: rawDescription, state, bitbucketInvalidReviewers, + targetBranch, }: UpdatePrConfig & { bitbucketInvalidReviewers: string[] | undefined; }): Promise { @@ -878,6 +879,9 @@ export async function updatePr({ (name: string) => !bitbucketInvalidReviewers?.includes(name) ) .map((name: string) => ({ user: { name } })), + toRef: { + id: `refs/heads/${targetBranch}`, + }, }, } ); @@ -919,6 +923,7 @@ export async function updatePr({ prBody: rawDescription, state, bitbucketInvalidReviewers: invalidReviewers, + targetBranch, }); } else { throw new Error(REPOSITORY_CHANGED); diff --git a/lib/modules/platform/bitbucket/index.spec.ts b/lib/modules/platform/bitbucket/index.spec.ts index 4e1cd431905e7f7..6d9988b15be5aa6 100644 --- a/lib/modules/platform/bitbucket/index.spec.ts +++ b/lib/modules/platform/bitbucket/index.spec.ts @@ -1175,7 +1175,12 @@ describe('modules/platform/bitbucket/index', () => { .put('/2.0/repositories/some/repo/pullrequests/5') .reply(200); await expect( - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).toResolve(); }); @@ -1238,7 +1243,12 @@ describe('modules/platform/bitbucket/index', () => { .put('/2.0/repositories/some/repo/pullrequests/5') .reply(200); await expect( - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).toResolve(); }); @@ -1282,7 +1292,12 @@ describe('modules/platform/bitbucket/index', () => { .reply(200); await expect( - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).toResolve(); }); @@ -1314,7 +1329,12 @@ describe('modules/platform/bitbucket/index', () => { ) .reply(401); await expect(() => - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).rejects.toThrow(new Error('Response code 401 (Unauthorized)')); }); @@ -1339,7 +1359,12 @@ describe('modules/platform/bitbucket/index', () => { }, }); await expect(() => - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).rejects.toThrowErrorMatchingSnapshot(); }); @@ -1364,7 +1389,12 @@ describe('modules/platform/bitbucket/index', () => { }, }); await expect(() => - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).rejects.toThrow(new Error('Response code 400 (Bad Request)')); }); @@ -1374,7 +1404,12 @@ describe('modules/platform/bitbucket/index', () => { .get('/2.0/repositories/some/repo/pullrequests/5') .reply(500, undefined); await expect(() => - bitbucket.updatePr({ number: 5, prTitle: 'title', prBody: 'body' }) + bitbucket.updatePr({ + number: 5, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).rejects.toThrowErrorMatchingSnapshot(); }); @@ -1393,6 +1428,7 @@ describe('modules/platform/bitbucket/index', () => { number: pr.id, prTitle: pr.title, state: 'closed', + targetBranch: 'target_branch', }) ).toBeUndefined(); }); diff --git a/lib/modules/platform/bitbucket/index.ts b/lib/modules/platform/bitbucket/index.ts index de980f3b5201e49..6b74ea8042703e5 100644 --- a/lib/modules/platform/bitbucket/index.ts +++ b/lib/modules/platform/bitbucket/index.ts @@ -879,6 +879,7 @@ export async function updatePr({ prTitle: title, prBody: description, state, + targetBranch, }: UpdatePrConfig): Promise { logger.debug(`updatePr(${prNo}, ${title}, body)`); // Updating a PR in Bitbucket will clear the reviewers if reviewers is not present @@ -896,6 +897,11 @@ export async function updatePr({ title, description: sanitize(description), reviewers: pr.reviewers, + destination: { + branch: { + name: targetBranch, + }, + }, }, } ); @@ -913,6 +919,11 @@ export async function updatePr({ title, description: sanitize(description), reviewers: sanitizedReviewers, + destination: { + branch: { + name: targetBranch, + }, + }, }, } ); diff --git a/lib/modules/platform/codecommit/index.spec.ts b/lib/modules/platform/codecommit/index.spec.ts index 6dfc43483ab9df3..4f066ff7e2f4645 100644 --- a/lib/modules/platform/codecommit/index.spec.ts +++ b/lib/modules/platform/codecommit/index.spec.ts @@ -698,6 +698,7 @@ describe('modules/platform/codecommit/index', () => { prTitle: 'title', prBody: 'body', state: 'open', + targetBranch: 'target_branch', }) ).toResolve(); }); @@ -725,6 +726,7 @@ describe('modules/platform/codecommit/index', () => { prTitle: 'title', prBody: 'new description', state: 'open', + targetBranch: 'target_branch', }) ).toResolve(); }); @@ -751,6 +753,7 @@ describe('modules/platform/codecommit/index', () => { prTitle: 'title', prBody: 'new description', state: 'open', + targetBranch: 'target_branch', }) ).toResolve(); }); @@ -767,6 +770,7 @@ describe('modules/platform/codecommit/index', () => { prTitle: 'title', prBody: 'body', state: 'open', + targetBranch: 'target_branch', }) ).toResolve(); }); @@ -781,6 +785,7 @@ describe('modules/platform/codecommit/index', () => { prTitle: 'title', prBody: 'body', state: 'closed', + targetBranch: 'target_branch', }) ).toResolve(); }); diff --git a/lib/modules/platform/codecommit/index.ts b/lib/modules/platform/codecommit/index.ts index 6ce173083c49017..313d06976d5c696 100644 --- a/lib/modules/platform/codecommit/index.ts +++ b/lib/modules/platform/codecommit/index.ts @@ -400,6 +400,7 @@ export async function updatePr({ prTitle: title, prBody: body, state, + targetBranch, }: UpdatePrConfig): Promise { logger.debug(`updatePr(${prNo}, ${title}, body)`); diff --git a/lib/modules/platform/gitea/index.spec.ts b/lib/modules/platform/gitea/index.spec.ts index 4b61916037cf344..bc5475ef2944c55 100644 --- a/lib/modules/platform/gitea/index.spec.ts +++ b/lib/modules/platform/gitea/index.spec.ts @@ -1107,7 +1107,7 @@ describe('modules/platform/gitea/index', () => { expect(helper.updatePR).toHaveBeenCalledWith( mockRepo.full_name, mockNewPR.number, - { title: 'new-title', body: 'new-body' } + { title: 'new-title', body: 'new-body', base: 'master' } ); }); @@ -1222,11 +1222,16 @@ describe('modules/platform/gitea/index', () => { it('should update pull request with title', async () => { helper.searchPRs.mockResolvedValueOnce(mockPRs); await initFakeRepo(); - await gitea.updatePr({ number: 1, prTitle: 'New Title' }); + await gitea.updatePr({ + number: 1, + prTitle: 'New Title', + targetBranch: 'target_branch', + }); expect(helper.updatePR).toHaveBeenCalledTimes(1); expect(helper.updatePR).toHaveBeenCalledWith(mockRepo.full_name, 1, { title: 'New Title', + base: 'target_branch', }); }); @@ -1237,12 +1242,14 @@ describe('modules/platform/gitea/index', () => { number: 1, prTitle: 'New Title', prBody: 'New Body', + targetBranch: 'target_branch', }); expect(helper.updatePR).toHaveBeenCalledTimes(1); expect(helper.updatePR).toHaveBeenCalledWith(mockRepo.full_name, 1, { title: 'New Title', body: 'New Body', + base: 'target_branch', }); }); @@ -1253,12 +1260,14 @@ describe('modules/platform/gitea/index', () => { number: 3, prTitle: 'New Title', prBody: 'New Body', + targetBranch: 'target_branch', }); expect(helper.updatePR).toHaveBeenCalledTimes(1); expect(helper.updatePR).toHaveBeenCalledWith(mockRepo.full_name, 3, { title: 'WIP: New Title', body: 'New Body', + base: 'target_branch', }); }); @@ -1270,12 +1279,14 @@ describe('modules/platform/gitea/index', () => { prTitle: 'New Title', prBody: 'New Body', state: 'closed', + targetBranch: 'target_branch', }); expect(helper.updatePR).toHaveBeenCalledWith(mockRepo.full_name, 1, { title: 'New Title', body: 'New Body', state: 'closed', + base: 'target_branch', }); }); }); diff --git a/lib/modules/platform/gitea/index.ts b/lib/modules/platform/gitea/index.ts index ecc8e64bfa5c3cb..802c2c5fc02da59 100644 --- a/lib/modules/platform/gitea/index.ts +++ b/lib/modules/platform/gitea/index.ts @@ -600,6 +600,7 @@ const platform: Platform = { number: pr.number, prTitle: title, prBody: body, + targetBranch, }); pr.title = title; pr.bodyStruct = getPrBodyStruct(body); @@ -622,6 +623,7 @@ const platform: Platform = { prTitle, prBody: body, state, + targetBranch, }: UpdatePrConfig): Promise { let title = prTitle; if ((await getPrList()).find((pr) => pr.number === number)?.isDraft) { @@ -632,6 +634,7 @@ const platform: Platform = { title, ...(body && { body }), ...(state && { state }), + base: targetBranch, }); }, diff --git a/lib/modules/platform/gitea/types.ts b/lib/modules/platform/gitea/types.ts index de89f4f46a8765f..bc6d78fc8cab8db 100644 --- a/lib/modules/platform/gitea/types.ts +++ b/lib/modules/platform/gitea/types.ts @@ -169,7 +169,6 @@ export interface IssueSearchParams { } export interface PRCreateParams extends PRUpdateParams { - base?: string; head?: string; } @@ -179,6 +178,7 @@ export interface PRUpdateParams { assignees?: string[]; labels?: number[]; state?: PRState; + base?: string; } export interface PRSearchParams { diff --git a/lib/modules/platform/github/common.ts b/lib/modules/platform/github/common.ts index 8fac76f9ee052ac..afcbaf72c5c3203 100644 --- a/lib/modules/platform/github/common.ts +++ b/lib/modules/platform/github/common.ts @@ -16,6 +16,7 @@ export function coerceRestPr(pr: GhRestPr): GhPr { bodyStruct, updated_at: pr.updated_at, node_id: pr.node_id, + targetBranch: pr.base?.ref, }; if (pr.head?.sha) { diff --git a/lib/modules/platform/github/index.spec.ts b/lib/modules/platform/github/index.spec.ts index 0789f597bcb2058..7b531df325f7a25 100644 --- a/lib/modules/platform/github/index.spec.ts +++ b/lib/modules/platform/github/index.spec.ts @@ -2752,6 +2752,7 @@ describe('modules/platform/github/index', () => { number: 1234, prTitle: 'The New Title', prBody: 'Hello world again', + targetBranch: 'target_branch', }; const scope = httpMock.scope(githubApiHost); initRepoMock(scope, 'some/repo'); @@ -2767,6 +2768,7 @@ describe('modules/platform/github/index', () => { prTitle: 'The New Title', prBody: 'Hello world again', state: 'closed', + targetBranch: 'target_branch', }; const scope = httpMock.scope(githubApiHost); initRepoMock(scope, 'some/repo'); diff --git a/lib/modules/platform/github/index.ts b/lib/modules/platform/github/index.ts index a90fb2a4acc819c..33605bc2efedcac 100644 --- a/lib/modules/platform/github/index.ts +++ b/lib/modules/platform/github/index.ts @@ -1567,6 +1567,7 @@ export async function updatePr({ prTitle: title, prBody: rawBody, state, + targetBranch, }: UpdatePrConfig): Promise { logger.debug(`updatePr(${prNo}, ${title}, body)`); const body = sanitize(rawBody); @@ -1579,6 +1580,7 @@ export async function updatePr({ } const options: any = { body: patchBody, + base: targetBranch, }; // istanbul ignore if if (config.forkToken) { diff --git a/lib/modules/platform/gitlab/index.spec.ts b/lib/modules/platform/gitlab/index.spec.ts index 500e7ccb6b86039..c22649e6aefd3e4 100644 --- a/lib/modules/platform/gitlab/index.spec.ts +++ b/lib/modules/platform/gitlab/index.spec.ts @@ -2056,7 +2056,12 @@ describe('modules/platform/gitlab/index', () => { .put('/api/v4/projects/undefined/merge_requests/1') .reply(200); await expect( - gitlab.updatePr({ number: 1, prTitle: 'title', prBody: 'body' }) + gitlab.updatePr({ + number: 1, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).toResolve(); }); @@ -2078,7 +2083,12 @@ describe('modules/platform/gitlab/index', () => { .put('/api/v4/projects/undefined/merge_requests/1') .reply(200); await expect( - gitlab.updatePr({ number: 1, prTitle: 'title', prBody: 'body' }) + gitlab.updatePr({ + number: 1, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).toResolve(); }); @@ -2100,7 +2110,12 @@ describe('modules/platform/gitlab/index', () => { .put('/api/v4/projects/undefined/merge_requests/1') .reply(200); await expect( - gitlab.updatePr({ number: 1, prTitle: 'title', prBody: 'body' }) + gitlab.updatePr({ + number: 1, + prTitle: 'title', + prBody: 'body', + targetBranch: 'target_branch', + }) ).toResolve(); }); @@ -2127,6 +2142,7 @@ describe('modules/platform/gitlab/index', () => { prTitle: 'title', prBody: 'body', state: 'closed', + targetBranch: 'target_branch', }) ).toResolve(); }); diff --git a/lib/modules/platform/gitlab/index.ts b/lib/modules/platform/gitlab/index.ts index 17e6a497288831b..f35b11beb23e93b 100644 --- a/lib/modules/platform/gitlab/index.ts +++ b/lib/modules/platform/gitlab/index.ts @@ -675,6 +675,7 @@ export async function updatePr({ prBody: description, state, platformOptions, + targetBranch, }: UpdatePrConfig): Promise { let title = prTitle; if ((await getPrList()).find((pr) => pr.number === iid)?.isDraft) { @@ -692,6 +693,7 @@ export async function updatePr({ title, description: sanitize(description), ...(newState && { state_event: newState }), + target_branch: targetBranch, }, } ); diff --git a/lib/modules/platform/types.ts b/lib/modules/platform/types.ts index bfc54c32251a4c5..fd8f059bef58f63 100644 --- a/lib/modules/platform/types.ts +++ b/lib/modules/platform/types.ts @@ -108,6 +108,7 @@ export interface CreatePRConfig { } export interface UpdatePrConfig { number: number; + targetBranch: string; platformOptions?: PlatformPrOptions; prTitle: string; prBody?: string; diff --git a/lib/workers/repository/config-migration/pr/index.ts b/lib/workers/repository/config-migration/pr/index.ts index c24a1dd1aa472db..1f02da609bfa494 100644 --- a/lib/workers/repository/config-migration/pr/index.ts +++ b/lib/workers/repository/config-migration/pr/index.ts @@ -85,6 +85,7 @@ ${ number: existingPr.number, prTitle, prBody, + targetBranch: 'target_branch', }); logger.info({ pr: existingPr.number }, 'Migration PR updated'); } diff --git a/lib/workers/repository/error-config.ts b/lib/workers/repository/error-config.ts index b580d909f490789..52352f2344e9f67 100644 --- a/lib/workers/repository/error-config.ts +++ b/lib/workers/repository/error-config.ts @@ -50,11 +50,26 @@ async function raiseWarningIssue( const pr = await platform.getBranchPr(config.onboardingBranch!); if (pr?.state === 'open') { - await handleOnboardingPr(pr, body); - return; - } - - if (GlobalConfig.get('dryRun')) { + logger.debug('Updating onboarding PR with config error notice'); + body = `## Action Required: Fix Renovate Configuration\n\n${body}`; + body += `\n\nOnce you have resolved this problem (in this onboarding branch), Renovate will return to providing you with a preview of your repository's configuration.`; + if (GlobalConfig.get('dryRun')) { + logger.info(`DRY-RUN: Would update PR #${pr.number}`); + } else { + try { + await platform.updatePr({ + number: pr.number, + prTitle: config.onboardingPrTitle!, + prBody: body, + targetBranch: 'target_branch', + }); + } catch (err) /* istanbul ignore next */ { + logger.warn({ err }, 'Error updating onboarding PR'); + } + } + } else if (GlobalConfig.get('dryRun')) { + logger.info('DRY-RUN: Would ensure config error issue'); + } else if (config.suppressNotifications?.includes('configErrorIssue')) { logger.info( { configError: error }, 'DRY-RUN: Would ensure configuration error issue' diff --git a/lib/workers/repository/finalize/prune.ts b/lib/workers/repository/finalize/prune.ts index 88115d6daf50408..04602a866380a06 100644 --- a/lib/workers/repository/finalize/prune.ts +++ b/lib/workers/repository/finalize/prune.ts @@ -39,6 +39,7 @@ async function cleanUpBranches( number: pr.number, prTitle: newPrTitle, state: 'open', + targetBranch: 'target_branch', }); } @@ -67,6 +68,7 @@ async function cleanUpBranches( number: pr.number, prTitle: newPrTitle, state: 'closed', + targetBranch: 'target_branch', }); await scm.deleteBranch(branchName); } diff --git a/lib/workers/repository/onboarding/pr/index.ts b/lib/workers/repository/onboarding/pr/index.ts index 2bf76f3ee5526b5..b9bd7e9b7ccf17c 100644 --- a/lib/workers/repository/onboarding/pr/index.ts +++ b/lib/workers/repository/onboarding/pr/index.ts @@ -156,6 +156,7 @@ If you need any further assistance then you can also [request help here](${ number: existingPr.number, prTitle: existingPr.title, prBody, + targetBranch: 'target_branch', }); logger.info({ pr: existingPr.number }, 'Onboarding PR updated'); } diff --git a/lib/workers/repository/update/pr/index.ts b/lib/workers/repository/update/pr/index.ts index 0f8a8bef233fe8e..9e1e47ec96a6f92 100644 --- a/lib/workers/repository/update/pr/index.ts +++ b/lib/workers/repository/update/pr/index.ts @@ -342,7 +342,7 @@ export async function ensurePr( existingPrTitle === newPrTitle && existingPrBodyHash === newPrBodyHash ) { - // adds or-cache for existing PRs + // adds pr-cache for existing PRs setPrCache(branchName, prFingerprint, false); logger.debug( `Pull Request #${existingPr.number} does not need updating` @@ -372,6 +372,7 @@ export async function ensurePr( return { type: 'with-pr', pr: existingPr }; } else { await platform.updatePr({ + targetBranch: config.baseBranch ?? '', number: existingPr.number, prTitle, prBody, diff --git a/lib/workers/repository/update/pr/pr-fingerprint.ts b/lib/workers/repository/update/pr/pr-fingerprint.ts index 5e71b179454af95..e1d49d723cf8c29 100644 --- a/lib/workers/repository/update/pr/pr-fingerprint.ts +++ b/lib/workers/repository/update/pr/pr-fingerprint.ts @@ -37,6 +37,7 @@ export interface PrFingerprintConfig { pendingVersions?: string[]; filteredUpgrades?: FilteredBranchUpgradeConfig[]; + baseBranch?: string; } export function generatePrFingerprintConfig( @@ -74,6 +75,7 @@ export function generatePrFingerprintConfig( updateType: config.updateType, warnings: config.warnings, pendingVersions: config.pendingVersions, + baseBranch: config.baseBranch, }; }