diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts index a7c1d7fea48a699ed75c29bee7fff5df954e3780..efbe7292974db7aa14ef4c09f19c9471bbe9f778 100644 --- a/lib/platform/azure/index.ts +++ b/lib/platform/azure/index.ts @@ -15,6 +15,7 @@ import { Pr, Issue, VulnerabilityAlert, + CreatePRConfig, BranchStatusConfig, } from '../common'; import { sanitize } from '../../util/sanitize'; @@ -400,14 +401,14 @@ export async function getBranchStatus( return branchStatusCheck; } -export async function createPr( - branchName: string, - title: string, - body: string, - labels: string[], - useDefaultBranch?: boolean, - platformOptions: any = {} -): Promise<Pr> { +export async function createPr({ + branchName, + prTitle: title, + prBody: body, + labels, + useDefaultBranch, + platformOptions = {}, +}: CreatePRConfig): Promise<Pr> { const sourceRefName = azureHelper.getNewBranchName(branchName); const targetRefName = azureHelper.getNewBranchName( useDefaultBranch ? config.defaultBranch : config.baseBranch diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts index 51eeeffe95df2a0da65bfae5292aaae60751d1c4..729aa03ee707d292d9c1b8d948ca0dbbcad42b10 100644 --- a/lib/platform/bitbucket-server/index.ts +++ b/lib/platform/bitbucket-server/index.ts @@ -14,6 +14,7 @@ import { Issue, VulnerabilityAlert, GotResponse, + CreatePRConfig, BranchStatusConfig, } from '../common'; import { sanitize } from '../../util/sanitize'; @@ -860,13 +861,12 @@ export async function ensureCommentRemoval( const escapeHash = (input: string): string => input ? input.replace(/#/g, '%23') : input; -export async function createPr( - branchName: string, - title: string, - rawDescription: string, - _labels?: string[] | null, - useDefaultBranch?: boolean -): Promise<Pr> { +export async function createPr({ + branchName, + prTitle: title, + prBody: rawDescription, + useDefaultBranch, +}: CreatePRConfig): Promise<Pr> { const description = sanitize(rawDescription); logger.debug(`createPr(${branchName}, title=${title})`); const base = useDefaultBranch ? config.defaultBranch : config.baseBranch; diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts index b0091534066aa305175182586e19d3251c864588..4c7a5ebb127e658c5c5c6f879fd6340d6b9ed8a0 100644 --- a/lib/platform/bitbucket/index.ts +++ b/lib/platform/bitbucket/index.ts @@ -14,6 +14,7 @@ import { Pr, Issue, VulnerabilityAlert, + CreatePRConfig, EnsureIssueConfig, BranchStatusConfig, } from '../common'; @@ -669,13 +670,12 @@ export function ensureCommentRemoval( } // Creates PR and returns PR number -export async function createPr( - branchName: string, - title: string, - description: string, - _labels?: string[], - useDefaultBranch = true -): Promise<Pr> { +export async function createPr({ + branchName, + prTitle: title, + prBody: description, + useDefaultBranch = true, +}: CreatePRConfig): Promise<Pr> { // labels is not supported in Bitbucket: https://bitbucket.org/site/master/issues/11976/ability-to-add-labels-to-pull-requests-bb const base = useDefaultBranch diff --git a/lib/platform/common.ts b/lib/platform/common.ts index 79ab757577bca195557d76169b840eee0ccf1e51..34f105ed1d440622216e88f369a2b4463c221cd1 100644 --- a/lib/platform/common.ts +++ b/lib/platform/common.ts @@ -104,11 +104,18 @@ export type BranchStatus = | 'failure'; export type PlatformPrOptions = { - azureAutoComplete: boolean; - statusCheckVerify: boolean; - gitLabAutomerge: boolean; + azureAutoComplete?: boolean; + statusCheckVerify?: boolean; + gitLabAutomerge?: boolean; }; - +export interface CreatePRConfig { + branchName: string; + prTitle: string; + prBody: string; + labels?: string[] | null; + useDefaultBranch?: boolean; + platformOptions?: PlatformPrOptions; +} export interface EnsureIssueConfig { title: string; body: string; @@ -148,14 +155,7 @@ export interface Platform { mergePr(number: number, branchName: string): Promise<boolean>; addReviewers(number: number, reviewers: string[]): Promise<void>; addAssignees(number: number, assignees: string[]): Promise<void>; - createPr( - branchName: string, - prTitle: string, - prBody: string, - labels?: string[] | null, - useDefaultBranch?: boolean, - platformOptions?: PlatformPrOptions - ): Promise<Pr>; + createPr(prConfig: CreatePRConfig): Promise<Pr>; getBranchLastCommitTime(branchName: string): Promise<Date>; getRepos(): Promise<string[]>; isBranchStale(branchName: string): Promise<boolean>; diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index e9691aeaa5553f9866a667e969d0efa6d5f7f9a9..a8a86bb1806cc6a1c10f8058fd7f94c3f1994bd6 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -13,6 +13,7 @@ import { RepoConfig, Issue, VulnerabilityAlert, + CreatePRConfig, EnsureIssueConfig, BranchStatusConfig, } from '../common'; @@ -1570,14 +1571,14 @@ export async function ensureCommentRemoval( // Pull Request // Creates PR and returns PR number -export async function createPr( - branchName: string, - title: string, - rawBody: string, - labels: string[] | null, - useDefaultBranch: boolean, - platformOptions: { statusCheckVerify?: boolean } = {} -): Promise<Pr> { +export async function createPr({ + branchName, + prTitle: title, + prBody: rawBody, + labels, + useDefaultBranch, + platformOptions = {}, +}: CreatePRConfig): Promise<Pr> { const body = sanitize(rawBody); const base = useDefaultBranch ? config.defaultBranch : config.baseBranch; // Include the repository owner to handle forkMode and regular mode diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index d30afcdb02ec5c4ac8c7356b5a97b586e2933131..b04600874c8a0934c04d41858c6febb12103ccbe 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -8,11 +8,11 @@ import { PlatformConfig, RepoParams, RepoConfig, - PlatformPrOptions, GotResponse, Pr, Issue, VulnerabilityAlert, + CreatePRConfig, EnsureIssueConfig, BranchStatusConfig, } from '../common'; @@ -328,14 +328,14 @@ export async function getBranchStatus( // Pull Request -export async function createPr( - branchName: string, - title: string, - rawDescription: string, - labels?: string[] | null, - useDefaultBranch?: boolean, - platformOptions?: PlatformPrOptions -): Promise<Pr> { +export async function createPr({ + branchName, + prTitle: title, + prBody: rawDescription, + labels, + useDefaultBranch, + platformOptions, +}: CreatePRConfig): Promise<Pr> { const description = sanitize(rawDescription); const targetBranch = useDefaultBranch ? config.defaultBranch diff --git a/lib/workers/pr/index.ts b/lib/workers/pr/index.ts index e8494a65fb3ca2bd4da064bc887b2688482a6afa..0ab179e0fd7c12ae46d0f7cd3b189c9b7137ecaf 100644 --- a/lib/workers/pr/index.ts +++ b/lib/workers/pr/index.ts @@ -304,14 +304,14 @@ export async function ensurePr( config.automergeType === 'pr' && config.gitLabAutomerge, }; - pr = await platform.createPr( + pr = await platform.createPr({ branchName, prTitle, prBody, - config.labels, - false, - platformOptions - ); + labels: config.labels, + useDefaultBranch: false, + platformOptions, + }); logger.info({ branch: branchName, pr: pr.number }, 'PR created'); } } catch (err) /* istanbul ignore next */ { diff --git a/lib/workers/repository/onboarding/pr/index.ts b/lib/workers/repository/onboarding/pr/index.ts index 0f79201d66dccd426b4364eb4d2bfd60e7b1bbee..1d3238a844d0ae87acb18641fb505ef4844028cf 100644 --- a/lib/workers/repository/onboarding/pr/index.ts +++ b/lib/workers/repository/onboarding/pr/index.ts @@ -120,13 +120,13 @@ If you need any further assistance then you can also [request help here](${confi if (config.dryRun) { logger.info('DRY-RUN: Would create onboarding PR'); } else { - const pr = await platform.createPr( - config.onboardingBranch, - config.onboardingPrTitle, + const pr = await platform.createPr({ + branchName: config.onboardingBranch, + prTitle: config.onboardingPrTitle, prBody, labels, - useDefaultBranch - ); + useDefaultBranch, + }); logger.info({ pr: pr.displayNumber }, 'Created onboarding PR'); } } catch (err) /* istanbul ignore next */ { diff --git a/test/platform/azure/index.spec.ts b/test/platform/azure/index.spec.ts index f099c734ea647213d12f6c5672d551afe30ca6ba..86c8c20ca885c6254f3632144e46ba8cb1bee051 100644 --- a/test/platform/azure/index.spec.ts +++ b/test/platform/azure/index.spec.ts @@ -492,12 +492,12 @@ describe('platform/azure', () => { pullRequestId: 456, } as any) ); - const pr = await azure.createPr( - 'some-branch', - 'The Title', - 'Hello world', - ['deps', 'renovate'] - ); + const pr = await azure.createPr({ + branchName: 'some-branch', + prTitle: 'The Title', + prBody: 'Hello world', + labels: ['deps', 'renovate'], + }); expect(pr).toMatchSnapshot(); }); it('should create and return a PR object from base branch', async () => { @@ -520,13 +520,13 @@ describe('platform/azure', () => { pullRequestId: 456, } as any) ); - const pr = await azure.createPr( - 'some-branch', - 'The Title', - 'Hello world', - ['deps', 'renovate'], - true - ); + const pr = await azure.createPr({ + branchName: 'some-branch', + prTitle: 'The Title', + prBody: 'Hello world', + labels: ['deps', 'renovate'], + useDefaultBranch: true, + }); expect(pr).toMatchSnapshot(); }); it('should create and return a PR object with auto-complete set', async () => { @@ -560,14 +560,14 @@ describe('platform/azure', () => { } as any) ); azureHelper.getRenovatePRFormat.mockImplementation(x => x as any); - const pr = await azure.createPr( - 'some-branch', - 'The Title', - 'Hello world', - ['deps', 'renovate'], - false, - { azureAutoComplete: true } - ); + const pr = await azure.createPr({ + branchName: 'some-branch', + prTitle: 'The Title', + prBody: 'Hello world', + labels: ['deps', 'renovate'], + useDefaultBranch: false, + platformOptions: { azureAutoComplete: true }, + }); expect(updateFn).toHaveBeenCalled(); expect(pr).toMatchSnapshot(); }); diff --git a/test/platform/bitbucket-server/index.spec.ts b/test/platform/bitbucket-server/index.spec.ts index becf461850b51e99f3de5de6d8910fb9d3754d19..16c24a8f5c69e99b22ce8e45f30bc3a935e5bfd8 100644 --- a/test/platform/bitbucket-server/index.spec.ts +++ b/test/platform/bitbucket-server/index.spec.ts @@ -473,7 +473,11 @@ describe('platform/bitbucket-server', () => { it('posts PR', async () => { expect.assertions(3); await initRepo(); - const { id } = await bitbucket.createPr('branch', 'title', 'body'); + const { id } = await bitbucket.createPr({ + branchName: 'branch', + prTitle: 'title', + prBody: 'body', + }); expect(id).toBe(5); expect(api.get.mock.calls).toMatchSnapshot(); expect(api.post.mock.calls).toMatchSnapshot(); @@ -482,13 +486,13 @@ describe('platform/bitbucket-server', () => { it('posts PR default branch', async () => { expect.assertions(3); await initRepo(); - const { id } = await bitbucket.createPr( - 'branch', - 'title', - 'body', - null, - true - ); + const { id } = await bitbucket.createPr({ + branchName: 'branch', + prTitle: 'title', + prBody: 'body', + labels: null, + useDefaultBranch: true, + }); expect(id).toBe(5); expect(api.get.mock.calls).toMatchSnapshot(); expect(api.post.mock.calls).toMatchSnapshot(); diff --git a/test/platform/bitbucket/index.spec.ts b/test/platform/bitbucket/index.spec.ts index ed573ad5d0fa4bc3cf8ca90e380b841e82f6dea3..9e73e4d28486103f638a892d9c143f2167d65047 100644 --- a/test/platform/bitbucket/index.spec.ts +++ b/test/platform/bitbucket/index.spec.ts @@ -400,7 +400,11 @@ describe('platform/bitbucket', () => { api.post.mockReturnValueOnce({ body: { id: 5 }, } as any); - const { number } = await bitbucket.createPr('branch', 'title', 'body'); + const { number } = await bitbucket.createPr({ + branchName: 'branch', + prTitle: 'title', + prBody: 'body', + }); expect(number).toBe(5); expect(api.post.mock.calls).toMatchSnapshot(); }); diff --git a/test/platform/github/index.spec.ts b/test/platform/github/index.spec.ts index 7d32d66f70ed92a7c12122d9f6f76695e052025b..aa10e5c0ef9623c82b70395d2c37195da732826a 100644 --- a/test/platform/github/index.spec.ts +++ b/test/platform/github/index.spec.ts @@ -1460,14 +1460,14 @@ describe('platform/github', () => { api.get.mockResolvedValueOnce({ body: [], } as any); - const pr = await github.createPr( - 'some-branch', - 'The Title', - 'Hello world', - ['deps', 'renovate'], - false, - { statusCheckVerify: true } - ); + const pr = await github.createPr({ + branchName: 'some-branch', + prTitle: 'The Title', + prBody: 'Hello world', + labels: ['deps', 'renovate'], + useDefaultBranch: false, + platformOptions: { statusCheckVerify: true }, + }); expect(pr).toMatchSnapshot(); expect(api.post.mock.calls).toMatchSnapshot(); }); @@ -1481,13 +1481,13 @@ describe('platform/github', () => { }, } as any) ); - const pr = await github.createPr( - 'some-branch', - 'The Title', - 'Hello world', - null, - true - ); + const pr = await github.createPr({ + branchName: 'some-branch', + prTitle: 'The Title', + prBody: 'Hello world', + labels: null, + useDefaultBranch: true, + }); expect(pr).toMatchSnapshot(); expect(api.post.mock.calls).toMatchSnapshot(); }); diff --git a/test/platform/gitlab/index.spec.ts b/test/platform/gitlab/index.spec.ts index 02005a220b34eec5e25075f57b86ef0dcdef6792..3ada3d3124104f5219d4884049b67911023fea85 100644 --- a/test/platform/gitlab/index.spec.ts +++ b/test/platform/gitlab/index.spec.ts @@ -811,12 +811,12 @@ describe('platform/gitlab', () => { iid: 12345, }, } as any); - const pr = await gitlab.createPr( - 'some-branch', - 'some-title', - 'the-body', - null - ); + const pr = await gitlab.createPr({ + branchName: 'some-branch', + prTitle: 'some-title', + prBody: 'the-body', + labels: null, + }); expect(pr).toMatchSnapshot(); expect(api.post.mock.calls).toMatchSnapshot(); }); @@ -827,13 +827,13 @@ describe('platform/gitlab', () => { iid: 12345, }, } as any); - const pr = await gitlab.createPr( - 'some-branch', - 'some-title', - 'the-body', - [], - true - ); + const pr = await gitlab.createPr({ + branchName: 'some-branch', + prTitle: 'some-title', + prBody: 'the-body', + labels: [], + useDefaultBranch: true, + }); expect(pr).toMatchSnapshot(); expect(api.post.mock.calls).toMatchSnapshot(); }); @@ -844,10 +844,17 @@ describe('platform/gitlab', () => { iid: 12345, }, } as any); - await gitlab.createPr('some-branch', 'some-title', 'the-body', [], true, { - azureAutoComplete: false, - statusCheckVerify: false, - gitLabAutomerge: true, + await gitlab.createPr({ + branchName: 'some-branch', + prTitle: 'some-title', + prBody: 'the-body', + labels: [], + useDefaultBranch: true, + platformOptions: { + azureAutoComplete: false, + statusCheckVerify: false, + gitLabAutomerge: true, + }, }); // expect(api.post.mock.calls).toMatchSnapshot(); expect(api.put.mock.calls).toMatchSnapshot(); diff --git a/test/workers/pr/__snapshots__/index.spec.ts.snap b/test/workers/pr/__snapshots__/index.spec.ts.snap index 24e043961cc2b8249afa9e2142a225f8b35fa022..29bb32942e8dd8ee8be2e02bf0edbc18ee3ba6d9 100644 --- a/test/workers/pr/__snapshots__/index.spec.ts.snap +++ b/test/workers/pr/__snapshots__/index.spec.ts.snap @@ -26,251 +26,75 @@ Array [ exports[`workers/pr ensurePr should add note about Pin 1`] = ` Array [ - "renovate/dummy-1.x", - "Update dependency dummy to v1.1.0", - "This PR contains the following updates: - -| Package | Type | Update | Change | -|---|---|---|---| -| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | pin | \`1.0.0\` -> \`1.1.0\` | - -:pushpin: **Important**: Renovate will wait until you have merged this Pin PR before creating any *upgrade* PRs for the affected packages. Add the preset \`:preserveSemverRanges\` your config if you instead don't wish to pin dependencies. - ---- - -### Release Notes - -<details> -<summary>renovateapp/dummy</summary> - -### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -</details> - ---- - -### Renovate configuration - -:date: **Schedule**: \\"before 5am\\" in timezone some timezone. - -:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. - -:recycle: **Rebasing**: Whenever PR is stale, or if you modify the PR title to begin with \\"\`rebase!\`\\". - -:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. - ---- - - - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", - Array [], - false, Object { - "azureAutoComplete": false, - "gitLabAutomerge": false, - "statusCheckVerify": false, + "branchName": "renovate/dummy-1.x", + "labels": Array [], + "platformOptions": Object { + "azureAutoComplete": false, + "gitLabAutomerge": false, + "statusCheckVerify": false, + }, + "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | pin | \`1.0.0\` -> \`1.1.0\` |\\n\\n:pushpin: **Important**: Renovate will wait until you have merged this Pin PR before creating any *upgrade* PRs for the affected packages. Add the preset \`:preserveSemverRanges\` your config if you instead don't wish to pin dependencies.\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n---\\n\\n### Renovate configuration\\n\\n:date: **Schedule**: \\"before 5am\\" in timezone some timezone.\\n\\n:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\n:recycle: **Rebasing**: Whenever PR is stale, or if you modify the PR title to begin with \\"\`rebase!\`\\".\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", + "prTitle": "Update dependency dummy to v1.1.0", + "useDefaultBranch": false, }, ] `; exports[`workers/pr ensurePr should create PR if success 1`] = ` Array [ - "renovate/dummy-1.x", - "Update dependency dummy to v1.1.0", - "This PR contains the following updates: - -| Package | Type | Update | Change | -|---|---|---|---| -| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` | - ---- - -### Release Notes - -<details> -<summary>renovateapp/dummy</summary> - -### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -</details> - ---- - -### Renovate configuration - -:date: **Schedule**: \\"before 5am\\" (UTC). - -:vertical_traffic_light: **Automerge**: Enabled. - -:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\". - -:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. - ---- - - - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", - Array [], - false, Object { - "azureAutoComplete": false, - "gitLabAutomerge": false, - "statusCheckVerify": false, + "branchName": "renovate/dummy-1.x", + "labels": Array [], + "platformOptions": Object { + "azureAutoComplete": false, + "gitLabAutomerge": false, + "statusCheckVerify": false, + }, + "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n---\\n\\n### Renovate configuration\\n\\n:date: **Schedule**: \\"before 5am\\" (UTC).\\n\\n:vertical_traffic_light: **Automerge**: Enabled.\\n\\n:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\".\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", + "prTitle": "Update dependency dummy to v1.1.0", + "useDefaultBranch": false, }, ] `; exports[`workers/pr ensurePr should create group PR 1`] = ` Array [ - "renovate/dummy-1.x", - "Update dependency dummy to v1.1.0", - "This PR contains the following updates: - -| Package | Type | Update | Change | -|---|---|---|---| -| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | lockFileMaintenance | \`1.0.0\` -> \`1.1.0\` | -| a | | | \`zzzzzz\` -> \`aaaaaaa\` | -| b | | pin | \`some_old_value\` -> \`some_new_value\` | -| c | | | \`\` -> \`\` | -| d | | lockFileMaintenance | \`\` -> \`\` | - -note 1 - -note 2 - -:abcd: If you wish to disable git hash updates, add \`\\":disableDigestUpdates\\"\` to the extends array in your config. - -:wrench: This Pull Request updates lock files to use the latest dependency versions. - ---- - -### Release Notes - -<details> -<summary>renovateapp/dummy</summary> - -### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -</details> - -<details> -<summary>renovateapp/dummy</summary> - -</details> - ---- - -### Renovate configuration - -:date: **Schedule**: At any time (no schedule defined). - -:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. - -:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\". - -:ghost: **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/config-help/issues) if that's undesired. - ---- - - - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", - Array [], - false, Object { - "azureAutoComplete": false, - "gitLabAutomerge": false, - "statusCheckVerify": false, + "branchName": "renovate/dummy-1.x", + "labels": Array [], + "platformOptions": Object { + "azureAutoComplete": false, + "gitLabAutomerge": false, + "statusCheckVerify": false, + }, + "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | lockFileMaintenance | \`1.0.0\` -> \`1.1.0\` |\\n| a | | | \`zzzzzz\` -> \`aaaaaaa\` |\\n| b | | pin | \`some_old_value\` -> \`some_new_value\` |\\n| c | | | \`\` -> \`\` |\\n| d | | lockFileMaintenance | \`\` -> \`\` |\\n\\nnote 1\\n\\nnote 2\\n\\n:abcd: If you wish to disable git hash updates, add \`\\":disableDigestUpdates\\"\` to the extends array in your config.\\n\\n:wrench: This Pull Request updates lock files to use the latest dependency versions.\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n</details>\\n\\n---\\n\\n### Renovate configuration\\n\\n:date: **Schedule**: At any time (no schedule defined).\\n\\n:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\n:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\".\\n\\n:ghost: **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/config-help/issues) if that's undesired.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", + "prTitle": "Update dependency dummy to v1.1.0", + "useDefaultBranch": false, }, ] `; exports[`workers/pr ensurePr should create privateRepo PR if success 1`] = ` Array [ - "renovate/dummy-1.x", - "Update dependency dummy to v1.1.0", - "This PR contains the following updates: - -| Package | Type | Update | Change | -|---|---|---|---| -| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` | - ---- - -### Release Notes - -<details> -<summary>renovateapp/dummy</summary> - -### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -</details> - ---- - -### Renovate configuration - -:date: **Schedule**: At any time (no schedule defined). - -:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. - -:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\". - -:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. - ---- - - - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", - Array [], - false, Object { - "azureAutoComplete": false, - "gitLabAutomerge": false, - "statusCheckVerify": false, + "branchName": "renovate/dummy-1.x", + "labels": Array [], + "platformOptions": Object { + "azureAutoComplete": false, + "gitLabAutomerge": false, + "statusCheckVerify": false, + }, + "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n---\\n\\n### Renovate configuration\\n\\n:date: **Schedule**: At any time (no schedule defined).\\n\\n:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\n:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\".\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", + "prTitle": "Update dependency dummy to v1.1.0", + "useDefaultBranch": false, }, ] `; exports[`workers/pr ensurePr should return modified existing PR 1`] = ` Object { - "body": "This PR contains the following updates: - -| Package | Type | Update | Change | -|---|---|---|---| -| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` | - ---- - -### Release Notes - -<details> -<summary>renovateapp/dummy</summary> - -### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -</details> - ---- - -### Renovate configuration - -:date: **Schedule**: \\"before 5am\\" (UTC). - -:vertical_traffic_light: **Automerge**: Enabled. - -:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\". - -:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. - ---- - - - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", + "body": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n---\\n\\n### Renovate configuration\\n\\n:date: **Schedule**: \\"before 5am\\" (UTC).\\n\\n:vertical_traffic_light: **Automerge**: Enabled.\\n\\n:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\".\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", "displayNumber": "Existing PR", "isModified": false, "title": "Update dependency dummy to v1.1.0", @@ -279,40 +103,7 @@ Object { exports[`workers/pr ensurePr should return modified existing PR title 1`] = ` Object { - "body": "This PR contains the following updates: - -| Package | Type | Update | Change | -|---|---|---|---| -| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` | - ---- - -### Release Notes - -<details> -<summary>renovateapp/dummy</summary> - -### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0) - -</details> - ---- - -### Renovate configuration - -:date: **Schedule**: \\"before 5am\\" (UTC). - -:vertical_traffic_light: **Automerge**: Enabled. - -:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\". - -:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. - ---- - - - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", + "body": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n---\\n\\n### Renovate configuration\\n\\n:date: **Schedule**: \\"before 5am\\" (UTC).\\n\\n:vertical_traffic_light: **Automerge**: Enabled.\\n\\n:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\".\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box", "displayNumber": "Existing PR", "isModified": false, "title": "wrong", diff --git a/test/workers/pr/index.spec.ts b/test/workers/pr/index.spec.ts index dc5ba567485d603504d5e9335d23e47a5fba788e..39f83a0ef2d5c6cf34b039a91d7fdf86a10d27c3 100644 --- a/test/workers/pr/index.spec.ts +++ b/test/workers/pr/index.spec.ts @@ -171,7 +171,7 @@ describe('workers/pr', () => { const pr = await prWorker.ensurePr(config); expect(pr).toMatchObject({ displayNumber: 'New Pull Request' }); expect(platform.createPr.mock.calls[0]).toMatchSnapshot(); - existingPr.body = platform.createPr.mock.calls[0][2]; + existingPr.body = platform.createPr.mock.calls[0][0].prBody; }); it('should create group PR', async () => { config.upgrades = config.upgrades.concat([ @@ -215,9 +215,9 @@ describe('workers/pr', () => { const pr = await prWorker.ensurePr(config); expect(pr).toMatchObject({ displayNumber: 'New Pull Request' }); expect(platform.createPr.mock.calls[0]).toMatchSnapshot(); - expect(platform.createPr.mock.calls[0][2].includes('this Pin PR')).toBe( - true - ); + expect( + platform.createPr.mock.calls[0][0].prBody.includes('this Pin PR') + ).toBe(true); }); it('should return null if creating PR fails', async () => { platform.getBranchStatus.mockResolvedValueOnce('success'); @@ -412,7 +412,7 @@ describe('workers/pr', () => { const pr = await prWorker.ensurePr(config); expect(pr).toMatchObject({ displayNumber: 'New Pull Request' }); expect(platform.createPr.mock.calls[0]).toMatchSnapshot(); - existingPr.body = platform.createPr.mock.calls[0][2]; + existingPr.body = platform.createPr.mock.calls[0][0].prBody; }); it('should create PR if waiting for not pending but artifactErrors', async () => { platform.getBranchStatus.mockResolvedValueOnce('pending'); @@ -429,7 +429,7 @@ describe('workers/pr', () => { config.automerge = true; await prWorker.ensurePr(config); const args = platform.createPr.mock.calls[0]; - expect(args[5]).toMatchObject({ + expect(args[0].platformOptions).toMatchObject({ gitLabAutomerge: true, }); }); diff --git a/test/workers/repository/onboarding/pr/index.spec.js b/test/workers/repository/onboarding/pr/index.spec.js index 133adebe83ed98486d0aa1efeca4d93b40269ba6..80ae3dd6b55f78090552b13ee71fd5179704a106 100644 --- a/test/workers/repository/onboarding/pr/index.spec.js +++ b/test/workers/repository/onboarding/pr/index.spec.js @@ -33,7 +33,7 @@ describe('workers/repository/onboarding/pr', () => { it('creates PR', async () => { await ensureOnboardingPr(config, packageFiles, branches); expect(platform.createPr).toHaveBeenCalledTimes(1); - createPrBody = platform.createPr.mock.calls[0][2]; + createPrBody = platform.createPr.mock.calls[0][0].prBody; }); it('returns if PR does not need updating', async () => { platform.getBranchPr.mockReturnValue({