diff --git a/lib/platform/azure/index.spec.ts b/lib/platform/azure/index.spec.ts index 3b464d06980701d1de1ce2eafbb883ce19d94a1d..878668f1cf779dc0d4963b5655802ee11d8eff79 100644 --- a/lib/platform/azure/index.spec.ts +++ b/lib/platform/azure/index.spec.ts @@ -500,6 +500,7 @@ describe('platform/azure', () => { ); const pr = await azure.createPr({ branchName: 'some-branch', + targetBranch: 'master', prTitle: 'The Title', prBody: 'Hello world', labels: ['deps', 'renovate'], @@ -528,6 +529,7 @@ describe('platform/azure', () => { ); const pr = await azure.createPr({ branchName: 'some-branch', + targetBranch: 'master', prTitle: 'The Title', prBody: 'Hello world', labels: ['deps', 'renovate'], diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts index 1c500fc994cef4b26b7622e2dd50428f6ddfa1c1..184fb10ad7d05ee5fa29f05890b49a891e99bb3b 100644 --- a/lib/platform/azure/index.ts +++ b/lib/platform/azure/index.ts @@ -336,7 +336,7 @@ export async function getBranchStatus( export async function createPr({ branchName, - targetBranch = config.defaultBranch, + targetBranch, prTitle: title, prBody: body, labels, diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts index 697d935904afc5620d89a76d5a2531549ae26f26..062e4976bb95c72eaf0d82f8ad5f19e96909ffc3 100644 --- a/lib/platform/bitbucket-server/index.spec.ts +++ b/lib/platform/bitbucket-server/index.spec.ts @@ -1119,6 +1119,7 @@ describe(getName(__filename), () => { const { number: id } = await bitbucket.createPr({ branchName: 'branch', + targetBranch: 'master', prTitle: 'title', prBody: 'body', }); @@ -1142,6 +1143,7 @@ describe(getName(__filename), () => { const { number: id } = await bitbucket.createPr({ branchName: 'branch', + targetBranch: 'master', prTitle: 'title', prBody: 'body', labels: null, diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts index 813e9ee45b0a58c1c597beb142a27e86684890e4..e407724c298742baae792ab91f65507452785586 100644 --- a/lib/platform/bitbucket-server/index.ts +++ b/lib/platform/bitbucket-server/index.ts @@ -794,7 +794,7 @@ const escapeHash = (input: string): string => export async function createPr({ branchName, - targetBranch = config.defaultBranch, + targetBranch, prTitle: title, prBody: rawDescription, }: CreatePRConfig): Promise<Pr> { diff --git a/lib/platform/bitbucket/index.spec.ts b/lib/platform/bitbucket/index.spec.ts index e33c5a82fb561d7107fa96ed2dcca5ad68b7d7f8..04a7878af3fa6c62e9e13f66072d1e996c4a060f 100644 --- a/lib/platform/bitbucket/index.spec.ts +++ b/lib/platform/bitbucket/index.spec.ts @@ -681,6 +681,7 @@ describe('platform/bitbucket', () => { .reply(200, { id: 5 }); const { number } = await bitbucket.createPr({ branchName: 'branch', + targetBranch: 'master', prTitle: 'title', prBody: 'body', }); diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts index 7b6583568e0f88ff3848352c10ce2f97a912043c..65ee99b9c22cdc2719b7c973dbc576bf1b16aa49 100644 --- a/lib/platform/bitbucket/index.ts +++ b/lib/platform/bitbucket/index.ts @@ -658,7 +658,7 @@ export function ensureCommentRemoval({ // Creates PR and returns PR number export async function createPr({ branchName, - targetBranch = config.defaultBranch, + targetBranch, prTitle: title, prBody: description, }: CreatePRConfig): Promise<Pr> { diff --git a/lib/platform/common.ts b/lib/platform/common.ts index d154ddf2059747ba9503143f67e734843611d13c..3cd74377554ed432be1159039f0e5c906f1c9ad8 100644 --- a/lib/platform/common.ts +++ b/lib/platform/common.ts @@ -72,7 +72,7 @@ export type PlatformPrOptions = { }; export interface CreatePRConfig { branchName: string; - targetBranch?: string; + targetBranch: string; prTitle: string; prBody: string; labels?: string[] | null; diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts index a03e2c7f396eb05dcacaf85f94a7a0d97f4c89be..7d7cb2fe19d40887986876c43b6feeee8bbd0178 100644 --- a/lib/platform/gitea/index.spec.ts +++ b/lib/platform/gitea/index.spec.ts @@ -716,6 +716,7 @@ describe('platform/gitea', () => { await gitea.setBaseBranch('devel'); const res = await gitea.createPr({ branchName: mockNewPR.head.label, + targetBranch: 'master', prTitle: mockNewPR.title, prBody: mockNewPR.body, }); @@ -743,6 +744,7 @@ describe('platform/gitea', () => { await initFakeRepo(); await gitea.createPr({ branchName: mockNewPR.head.label, + targetBranch: 'master', prTitle: mockNewPR.title, prBody: mockNewPR.body, labels: mockLabels.map((l) => l.name), @@ -766,6 +768,7 @@ describe('platform/gitea', () => { await gitea.getPrList(); await gitea.createPr({ branchName: mockNewPR.head.label, + targetBranch: 'master', prTitle: mockNewPR.title, prBody: mockNewPR.body, }); @@ -782,6 +785,7 @@ describe('platform/gitea', () => { await initFakeRepo(); const res = await gitea.createPr({ branchName: mockNewPR.head.label, + targetBranch: 'master', prTitle: mockNewPR.title, prBody: mockNewPR.body, }); @@ -796,6 +800,7 @@ describe('platform/gitea', () => { await initFakeRepo(); const res = await gitea.createPr({ branchName: mockNewPR.head.label, + targetBranch: 'master', prTitle: 'new-title', prBody: 'new-body', }); @@ -816,6 +821,7 @@ describe('platform/gitea', () => { await expect( gitea.createPr({ branchName: mockNewPR.head.label, + targetBranch: 'master', prTitle: mockNewPR.title, prBody: mockNewPR.body, }) diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index b38845c870135ace19026552950de6d9d886e2f8..72053545cbe78fb5eb9a7fab02bb8ae552312f7a 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -486,7 +486,7 @@ const platform: Platform = { async createPr({ branchName, - targetBranch = config.defaultBranch, + targetBranch, prTitle: title, prBody: rawBody, labels: labelNames, diff --git a/lib/platform/github/index.spec.ts b/lib/platform/github/index.spec.ts index 95397b73ef38da970ea348130f1b08e39fdb66a5..1310d3bfeb292d6f0e7c64b1ded36d805bebd351 100644 --- a/lib/platform/github/index.spec.ts +++ b/lib/platform/github/index.spec.ts @@ -1620,6 +1620,7 @@ describe('platform/github', () => { await github.initRepo({ repository: 'some/repo', token: 'token' } as any); const pr = await github.createPr({ branchName: 'some-branch', + targetBranch: 'master', prTitle: 'The Title', prBody: 'Hello world', labels: null, @@ -1636,6 +1637,7 @@ describe('platform/github', () => { await github.initRepo({ repository: 'some/repo', token: 'token' } as any); const pr = await github.createPr({ branchName: 'some-branch', + targetBranch: 'master', prTitle: 'PR draft', prBody: 'This is a result of a draft', labels: null, diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 8d1b2c0be59f19dcf3db664d2a9a21e609484fe3..ade3fe6f4adb4164a33a5c94bbd79f0298a4b16a 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -1407,7 +1407,7 @@ export async function ensureCommentRemoval({ // Creates PR and returns PR number export async function createPr({ branchName, - targetBranch = config.defaultBranch, + targetBranch, prTitle: title, prBody: rawBody, labels, diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap index d18ffba7cd416d165c6a28368e1a5b8f1821497b..918580ccc62ebcaf80adfb48c22696e5d8f837d9 100644 --- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap @@ -146,11 +146,11 @@ exports[`platform/gitlab addReviewers(issueNo, reviewers) should add the given r exports[`platform/gitlab createPr(branchName, title, body) auto-accepts the MR when requested 1`] = ` Array [ Object { - "body": "{\\"source_branch\\":\\"some-branch\\",\\"remove_source_branch\\":true,\\"title\\":\\"some-title\\",\\"description\\":\\"the-body\\",\\"labels\\":\\"\\"}", + "body": "{\\"source_branch\\":\\"some-branch\\",\\"target_branch\\":\\"master\\",\\"remove_source_branch\\":true,\\"title\\":\\"some-title\\",\\"description\\":\\"the-body\\",\\"labels\\":\\"\\"}", "headers": Object { "accept": "application/json", "accept-encoding": "gzip, deflate", - "content-length": "117", + "content-length": "142", "content-type": "application/json", "host": "gitlab.com", "private-token": "abc123", @@ -211,11 +211,11 @@ Object { exports[`platform/gitlab createPr(branchName, title, body) returns the PR 2`] = ` Array [ Object { - "body": "{\\"source_branch\\":\\"some-branch\\",\\"remove_source_branch\\":true,\\"title\\":\\"some-title\\",\\"description\\":\\"the-body\\",\\"labels\\":null}", + "body": "{\\"source_branch\\":\\"some-branch\\",\\"target_branch\\":\\"master\\",\\"remove_source_branch\\":true,\\"title\\":\\"some-title\\",\\"description\\":\\"the-body\\",\\"labels\\":null}", "headers": Object { "accept": "application/json", "accept-encoding": "gzip, deflate", - "content-length": "119", + "content-length": "144", "content-type": "application/json", "host": "gitlab.com", "private-token": "abc123", @@ -240,11 +240,11 @@ Object { exports[`platform/gitlab createPr(branchName, title, body) uses default branch 2`] = ` Array [ Object { - "body": "{\\"source_branch\\":\\"some-branch\\",\\"remove_source_branch\\":true,\\"title\\":\\"some-title\\",\\"description\\":\\"the-body\\",\\"labels\\":\\"\\"}", + "body": "{\\"source_branch\\":\\"some-branch\\",\\"target_branch\\":\\"master\\",\\"remove_source_branch\\":true,\\"title\\":\\"some-title\\",\\"description\\":\\"the-body\\",\\"labels\\":\\"\\"}", "headers": Object { "accept": "application/json", "accept-encoding": "gzip, deflate", - "content-length": "117", + "content-length": "142", "content-type": "application/json", "host": "gitlab.com", "private-token": "abc123", diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts index e891e7ad3dcec5076b6e11d6dc32591257e4140c..ca818f05aead3738d7bf0ea1f647ba7fcdd61a06 100644 --- a/lib/platform/gitlab/index.spec.ts +++ b/lib/platform/gitlab/index.spec.ts @@ -974,6 +974,7 @@ describe('platform/gitlab', () => { }); const pr = await gitlab.createPr({ branchName: 'some-branch', + targetBranch: 'master', prTitle: 'some-title', prBody: 'the-body', labels: null, @@ -991,6 +992,7 @@ describe('platform/gitlab', () => { }); const pr = await gitlab.createPr({ branchName: 'some-branch', + targetBranch: 'master', prTitle: 'some-title', prBody: 'the-body', labels: [], @@ -1022,6 +1024,7 @@ describe('platform/gitlab', () => { .reply(200); await gitlab.createPr({ branchName: 'some-branch', + targetBranch: 'master', prTitle: 'some-title', prBody: 'the-body', labels: [], diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index 937b6e96b157897a2215afd2c7d341aa74ca405c..4d112fd04775101f1aa2533f481485bf55366843 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -356,7 +356,7 @@ export async function getBranchStatus( export async function createPr({ branchName, - targetBranch = config.defaultBranch, + targetBranch, prTitle: title, prBody: rawDescription, labels, diff --git a/lib/workers/repository/error.ts b/lib/workers/repository/error.ts index 469f4248facfee3ed549bce2e11754b45a30e544..f0a39befbd40a2fe50657f055f31aaa7ae42def2 100644 --- a/lib/workers/repository/error.ts +++ b/lib/workers/repository/error.ts @@ -175,7 +175,7 @@ export default async function handleError( return EXTERNAL_HOST_ERROR; } if ( - err.message.includes('The remote end hung up unexpectedly') || + err.message.includes('remote end hung up unexpectedly') || err.message.includes('access denied or repository not exported') ) { logger.warn({ err }, 'Git error - aborting'); diff --git a/lib/workers/repository/onboarding/pr/index.ts b/lib/workers/repository/onboarding/pr/index.ts index ec720cc199cb0af17577a67bf52e910be0f7663e..1ed8f339f5a72e1eacd732366d3b96248f8e46f5 100644 --- a/lib/workers/repository/onboarding/pr/index.ts +++ b/lib/workers/repository/onboarding/pr/index.ts @@ -128,6 +128,7 @@ If you need any further assistance then you can also [request help here](${confi } else { const pr = await platform.createPr({ branchName: config.onboardingBranch, + targetBranch: config.defaultBranch, prTitle: config.onboardingPrTitle, prBody, labels,