From e834f2b826ed7d94ac263be999df167b8c108282 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sun, 14 Jun 2020 08:49:52 +0200 Subject: [PATCH] feat: prHeader and prFooter (#6511) --- docs/usage/configuration-options.md | 4 ++++ docs/usage/self-hosted-configuration.md | 2 -- lib/config/definitions.ts | 9 +++++++-- lib/config/index.spec.ts | 2 +- lib/config/index.ts | 6 ------ lib/config/validation.ts | 1 - lib/workers/common.ts | 3 ++- lib/workers/pr/__snapshots__/index.spec.ts.snap | 14 +++++++------- lib/workers/pr/body/banner.ts | 16 ---------------- lib/workers/pr/body/footer.ts | 4 ++-- lib/workers/pr/body/header.ts | 10 ++++++++++ lib/workers/pr/body/index.ts | 6 +++--- lib/workers/repository/init/index.ts | 1 - lib/workers/repository/onboarding/pr/index.ts | 13 ++++++------- 14 files changed, 42 insertions(+), 49 deletions(-) delete mode 100644 lib/workers/pr/body/banner.ts create mode 100644 lib/workers/pr/body/header.ts diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index 6d6114286e4b10..309b4a2217dbef 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -1115,6 +1115,10 @@ This setting tells Renovate when you would like it to raise PRs: Renovate defaults to `immediate` but some like to change to `not-pending`. If you configure to immediate, it means you will usually get GitHub notifications that a new PR is available but if you view it immediately then it will still have "pending" tests so you can't take any action. With `not-pending`, it means that when you receive the PR notification, you can see if it passed or failed and take action immediately. Therefore you can customise this setting if you wish to be notified a little later in order to reduce "noise". +## prFooter + +## prHeader + ## prHourlyLimit This setting - if enabled - helps slow down Renovate, particularly during the onboarding phase. What may happen without this setting is: diff --git a/docs/usage/self-hosted-configuration.md b/docs/usage/self-hosted-configuration.md index 36b803d423aa57..c5f1568323691c 100644 --- a/docs/usage/self-hosted-configuration.md +++ b/docs/usage/self-hosted-configuration.md @@ -124,8 +124,6 @@ Set this to true if you wish for Renovate to persist repo data between runs. The Parameter to reduce CI load. CI jobs are usually triggered by these events: pull-request creation, pull-request update, automerge events. Set as an integer. Default is no limit. -## prFooter - ## printConfig This option is useful for troubleshooting, particularly if using presets. e.g. run `renovate foo/bar --print-config > config.log` and the fully-resolved config will be included in the log file. diff --git a/lib/config/definitions.ts b/lib/config/definitions.ts index 1bd317846885a1..df4622ca1803e8 100644 --- a/lib/config/definitions.ts +++ b/lib/config/definitions.ts @@ -1269,12 +1269,17 @@ const options: RenovateOptions[] = [ default: null, cli: false, }, + { + name: 'prHeader', + description: 'Any text added here will be placed first in the PR body.', + type: 'string', + }, { name: 'prFooter', - description: 'Pull Request footer template', + description: + 'Any text added here will be placed last in the PR body, with a divider separator before it.', type: 'string', default: `This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).`, - stage: 'global', }, { name: 'lockFileMaintenance', diff --git a/lib/config/index.spec.ts b/lib/config/index.spec.ts index 7a3534c957cfa2..e6a8f145fce08e 100644 --- a/lib/config/index.spec.ts +++ b/lib/config/index.spec.ts @@ -40,7 +40,7 @@ describe('config/index', () => { ); expect(parsedConfig).toContainEntries([ ['token', 'abc'], - ['global', { prFooter: 'custom' }], + ['prFooter', 'custom'], ['logContext', 'abc123'], ['customPrFooter', true], ]); diff --git a/lib/config/index.ts b/lib/config/index.ts index 27ce72d6e57631..45092d0d94c323 100644 --- a/lib/config/index.ts +++ b/lib/config/index.ts @@ -111,12 +111,6 @@ export async function parseConfigs( delete config.logFileLevel; // Move global variables that we need to use later - const importGlobals = ['prBanner', 'prFooter']; - config.global = {}; - importGlobals.forEach((key) => { - config.global[key] = config[key]; - delete config[key]; - }); global.trustLevel = config.trustLevel || /* istanbul ignore next: never happen? */ 'low'; delete config.trustLevel; diff --git a/lib/config/validation.ts b/lib/config/validation.ts index db3eb7baec4517..c70b4c2a627453 100644 --- a/lib/config/validation.ts +++ b/lib/config/validation.ts @@ -42,7 +42,6 @@ export async function validateConfig( function isIgnored(key: string): boolean { const ignoredNodes = [ '$schema', - 'prBanner', 'depType', 'npmToken', 'packageFile', diff --git a/lib/workers/common.ts b/lib/workers/common.ts index 4e16fc67a62d00..32a40a51c8a3a5 100644 --- a/lib/workers/common.ts +++ b/lib/workers/common.ts @@ -43,7 +43,8 @@ export interface BranchUpgradeConfig packageFile?: string; reuseExistingBranch?: boolean; - prBanner?: string; + prHeader?: string; + prFooter?: string; prBodyNotes?: string[]; prBodyTemplate?: string; prPriority?: number; diff --git a/lib/workers/pr/__snapshots__/index.spec.ts.snap b/lib/workers/pr/__snapshots__/index.spec.ts.snap index f94acbf5a45aba..7f0c00ac650f3e 100644 --- a/lib/workers/pr/__snapshots__/index.spec.ts.snap +++ b/lib/workers/pr/__snapshots__/index.spec.ts.snap @@ -49,7 +49,7 @@ Array [ "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
\\nrenovateapp/dummy\\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
\\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 behind base branch, or you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box", + "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
\\nrenovateapp/dummy\\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
\\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 behind base branch, or you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", "useDefaultBranch": false, }, @@ -80,7 +80,7 @@ Array [ "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
\\nrenovateapp/dummy\\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
\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box", + "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
\\nrenovateapp/dummy\\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
\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", "useDefaultBranch": false, }, @@ -98,7 +98,7 @@ Array [ "gitLabAutomerge": false, "statusCheckVerify": false, }, - "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [gitlabdummy](https://dummy.com) ([source](https://gitlab.com/renovateapp/gitlabdummy), [changelog](https://gitlab.com/renovateapp/gitlabdummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box", + "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [gitlabdummy](https://dummy.com) ([source](https://gitlab.com/renovateapp/gitlabdummy), [changelog](https://gitlab.com/renovateapp/gitlabdummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", "useDefaultBranch": false, }, @@ -116,7 +116,7 @@ Array [ "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:warning: Release Notes retrieval for this PR were skipped because no github.com credentials were available.\\nIf you are using the hosted GitLab app, please follow [this guide](https://docs.renovatebot.com/install-gitlab-app/#configuring-a-token-for-githubcom-hosted-release-notes). If you are self-hosted, please see [this instruction](https://github.com/renovatebot/renovate/blob/master/docs/development/self-hosting.md#githubcom-token-for-release-notes) instead.\\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
\\nrenovateapp/dummy\\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
\\n\\n
\\nrenovateapp/dummy\\n\\n
\\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**: Never, or you tick the rebase/retry checkbox.\\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 - [ ] If you want to rebase/retry this PR, check this box", + "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:warning: Release Notes retrieval for this PR were skipped because no github.com credentials were available.\\nIf you are using the hosted GitLab app, please follow [this guide](https://docs.renovatebot.com/install-gitlab-app/#configuring-a-token-for-githubcom-hosted-release-notes). If you are self-hosted, please see [this instruction](https://github.com/renovatebot/renovate/blob/master/docs/development/self-hosting.md#githubcom-token-for-release-notes) instead.\\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
\\nrenovateapp/dummy\\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
\\n\\n
\\nrenovateapp/dummy\\n\\n
\\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**: Never, or you tick the rebase/retry checkbox.\\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 - [ ] If you want to rebase/retry this PR, check this box\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", "useDefaultBranch": false, }, @@ -134,7 +134,7 @@ Array [ "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
\\nsomeproject\\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
\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box", + "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
\\nsomeproject\\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
\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", "useDefaultBranch": false, }, @@ -167,7 +167,7 @@ Array [ exports[`workers/pr ensurePr should return modified existing PR 1`] = ` Object { - "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
\\nrenovateapp/dummy\\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
\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] 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
\\nrenovateapp/dummy\\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
\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "displayNumber": "Existing PR", "isModified": false, "title": "Update dependency dummy to v1.1.0", @@ -176,7 +176,7 @@ Object { exports[`workers/pr ensurePr should return modified existing PR title 1`] = ` Object { - "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
\\nrenovateapp/dummy\\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
\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] 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
\\nrenovateapp/dummy\\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
\\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 you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "displayNumber": "Existing PR", "isModified": false, "title": "wrong", diff --git a/lib/workers/pr/body/banner.ts b/lib/workers/pr/body/banner.ts deleted file mode 100644 index 4a18283eee790e..00000000000000 --- a/lib/workers/pr/body/banner.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as template from '../../../util/template'; -import { BranchConfig } from '../../common'; - -// istanbul ignore next -export function getPrBanner(config: BranchConfig): string { - if (config.global && config.global.prBanner) { - return template.compile(config.global.prBanner, config) + '\n\n'; - } - if (config.isGroup) { - return ''; // TODO: why? - } - if (!config.prBanner) { - return ''; - } - return template.compile(config.prBanner, config) + '\n\n'; -} diff --git a/lib/workers/pr/body/footer.ts b/lib/workers/pr/body/footer.ts index 9a48c50e916d4e..7ddc72628962f0 100644 --- a/lib/workers/pr/body/footer.ts +++ b/lib/workers/pr/body/footer.ts @@ -3,8 +3,8 @@ import { BranchConfig } from '../../common'; // istanbul ignore next export function getPrFooter(config: BranchConfig): string { - if (config.global && config.global.prFooter) { - return '\n---\n\n' + template.compile(config.global.prFooter, config); + if (config.prFooter) { + return '\n---\n\n' + template.compile(config.prFooter, config); } return ''; } diff --git a/lib/workers/pr/body/header.ts b/lib/workers/pr/body/header.ts new file mode 100644 index 00000000000000..01cb09ca3a2f4e --- /dev/null +++ b/lib/workers/pr/body/header.ts @@ -0,0 +1,10 @@ +import * as template from '../../../util/template'; +import { BranchConfig } from '../../common'; + +// istanbul ignore next +export function getPrHeader(config: BranchConfig): string { + if (!config.prHeader) { + return ''; + } + return template.compile(config.prHeader, config) + '\n\n'; +} diff --git a/lib/workers/pr/body/index.ts b/lib/workers/pr/body/index.ts index 45d3ac19e65be8..5590e6100e3f5f 100644 --- a/lib/workers/pr/body/index.ts +++ b/lib/workers/pr/body/index.ts @@ -2,11 +2,11 @@ import { platform } from '../../../platform'; import * as template from '../../../util/template'; import { get } from '../../../versioning'; import { BranchConfig } from '../../common'; -import { getPrBanner } from './banner'; import { getChangelogs } from './changelogs'; import { getPrConfigDescription } from './config-description'; import { getControls } from './controls'; import { getPrFooter } from './footer'; +import { getPrHeader } from './header'; import { getPrExtraNotes, getPrNotes } from './notes'; import { getPrUpdatesTable } from './updates-table'; @@ -67,7 +67,7 @@ function massageUpdateMetadata(config: BranchConfig): void { export async function getPrBody(config: BranchConfig): Promise { massageUpdateMetadata(config); const content = { - banner: getPrBanner(config), + header: getPrHeader(config), table: getPrUpdatesTable(config), notes: getPrNotes(config) + getPrExtraNotes(config), changelogs: getChangelogs(config), @@ -76,7 +76,7 @@ export async function getPrBody(config: BranchConfig): Promise { footer: getPrFooter(config), }; const defaultPrBodyTemplate = - '{{{banner}}}{{{table}}}{{{notes}}}{{{changelogs}}}{{{configDescription}}}{{{controls}}}{{{footer}}}'; + '{{{header}}}{{{table}}}{{{notes}}}{{{changelogs}}}{{{configDescription}}}{{{controls}}}{{{footer}}}'; const prBodyTemplate = config.prBodyTemplate || defaultPrBodyTemplate; let prBody = template.compile(prBodyTemplate, content, false); prBody = prBody.trim(); diff --git a/lib/workers/repository/init/index.ts b/lib/workers/repository/init/index.ts index eea0a19e97608f..5b3688c960e300 100644 --- a/lib/workers/repository/init/index.ts +++ b/lib/workers/repository/init/index.ts @@ -18,7 +18,6 @@ export async function initRepo(input: RenovateConfig): Promise { warnings: [], branchList: [], }; - config.global = config.global || {}; config = await initApis(config); config.semanticCommits = await detectSemanticCommits(config); config.baseBranchSha = await platform.setBaseBranch(config.baseBranch); diff --git a/lib/workers/repository/onboarding/pr/index.ts b/lib/workers/repository/onboarding/pr/index.ts index 15d59ce4b7f659..e32e49aefbc40b 100644 --- a/lib/workers/repository/onboarding/pr/index.ts +++ b/lib/workers/repository/onboarding/pr/index.ts @@ -88,13 +88,12 @@ If you need any further assistance then you can also [request help here](${confi prBody = prBody.replace('{{BASEBRANCH}}\n', getBaseBranchDesc(config)); prBody = prBody.replace('{{PRLIST}}\n', getPrList(config, branches)); // istanbul ignore if - if (config.global) { - if (config.global.prBanner) { - prBody = config.global.prBanner + '\n\n' + prBody; - } - if (config.global.prFooter) { - prBody = prBody + '\n---\n\n' + config.global.prFooter + '\n'; - } + if (config.prHeader) { + prBody = (config.prHeader || '') + '\n\n' + prBody; + } + // istanbul ignore if + if (config.prFooter) { + prBody = prBody + '\n---\n\n' + config.prFooter + '\n'; } logger.trace('prBody:\n' + prBody);