diff --git a/lib/config/definitions.js b/lib/config/definitions.js index 4f04dd8966c73768682d87b84ea07abcad9525db..b66fb0b600983d2af0ce2c5d3a0746679f41f534 100644 --- a/lib/config/definitions.js +++ b/lib/config/definitions.js @@ -671,6 +671,14 @@ const options = [ default: template('prBody'), cli: false, }, + { + name: 'prFooter', + description: 'Pull Request footer template', + type: 'string', + default: + 'This PR has been generated by [Renovate Bot](https://renovateapp.com).', + stage: 'global', + }, // Yarn Lock Maintenance { name: 'lockFileMaintenance', diff --git a/lib/config/templates/default/pr-body.hbs b/lib/config/templates/default/pr-body.hbs index 868c52ee76b39f210c4a8935b32b76120142c40f..9bddc2860a0287b4128d10e278f0625e177847d5 100644 --- a/lib/config/templates/default/pr-body.hbs +++ b/lib/config/templates/default/pr-body.hbs @@ -73,7 +73,3 @@ Please make sure the following warnings are safe to ignore: - `{{warning.depName}}`: {{warning.message}} {{/each}} {{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/config/templates/docker-digest/pr-body.hbs b/lib/config/templates/docker-digest/pr-body.hbs index 2f3680f0aa349934fea65e1df5f88fa24d26973f..97e06b1d98f6a36eeb1df1b1861e91f02b778911 100644 --- a/lib/config/templates/docker-digest/pr-body.hbs +++ b/lib/config/templates/docker-digest/pr-body.hbs @@ -29,7 +29,3 @@ Please make sure the following warnings are safe to ignore: - `{{warning.depName}}`: {{warning.message}} {{/each}} {{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/config/templates/docker-group/pr-body.hbs b/lib/config/templates/docker-group/pr-body.hbs index af214cc4ccb7518cfe27929f7102a21421cb7d20..cd8c65e328e48c1f0c5f39f9df8f4dee88222f68 100644 --- a/lib/config/templates/docker-group/pr-body.hbs +++ b/lib/config/templates/docker-group/pr-body.hbs @@ -33,7 +33,3 @@ Please make sure the following warnings are safe to ignore: - `{{warning.depName}}`: {{warning.message}} {{/each}} {{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/config/templates/docker-pin-group/pr-body.hbs b/lib/config/templates/docker-pin-group/pr-body.hbs index e428e749b17b171af05a2101673d562570cfbb18..77f360c41983237a51d5fa8a86a63aed59b1b91e 100644 --- a/lib/config/templates/docker-pin-group/pr-body.hbs +++ b/lib/config/templates/docker-pin-group/pr-body.hbs @@ -35,7 +35,3 @@ Please make sure the following warnings are safe to ignore: - `{{warning.depName}}`: {{warning.message}} {{/each}} {{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/config/templates/docker-pin/pr-body.hbs b/lib/config/templates/docker-pin/pr-body.hbs index 13260a68859cbcc9861460189ee56bce22546a39..65b635dd11547f15b4ef232998fdf76b069fe86b 100644 --- a/lib/config/templates/docker-pin/pr-body.hbs +++ b/lib/config/templates/docker-pin/pr-body.hbs @@ -32,7 +32,3 @@ Please make sure the following warnings are safe to ignore: - `{{warning.depName}}`: {{warning.message}} {{/each}} {{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/config/templates/docker/pr-body.hbs b/lib/config/templates/docker/pr-body.hbs index 9af8a0c28b078bf6bcd63a00326b1944528efbbf..97dd5a82d39e4de4f8bc86a0a19337515138200f 100644 --- a/lib/config/templates/docker/pr-body.hbs +++ b/lib/config/templates/docker/pr-body.hbs @@ -29,7 +29,3 @@ Please make sure the following warnings are safe to ignore: - `{{warning.depName}}`: {{warning.message}} {{/each}} {{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/config/templates/group/pr-body.hbs b/lib/config/templates/group/pr-body.hbs index f84a88fc2d20298a916b2b013c270461b3d32f26..7bf9ebfe3e2c30cdebed4608af0b1aa8cc33c218 100644 --- a/lib/config/templates/group/pr-body.hbs +++ b/lib/config/templates/group/pr-body.hbs @@ -83,7 +83,3 @@ Please make sure the following warnings are safe to ignore: - `{{warning.depName}}`: {{warning.message}} {{/each}} {{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/config/templates/lock-file-maintenance/pr-body.hbs b/lib/config/templates/lock-file-maintenance/pr-body.hbs index 920bd373c7776919151d6d76a54bd54c42114189..8f46bf30291b4fa797cd82fde589c2194138a641 100644 --- a/lib/config/templates/lock-file-maintenance/pr-body.hbs +++ b/lib/config/templates/lock-file-maintenance/pr-body.hbs @@ -29,7 +29,3 @@ Please make sure the following warnings are safe to ignore: - `{{warning.depName}}`: {{warning.message}} {{/each}} {{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/config/templates/node/pr-body.hbs b/lib/config/templates/node/pr-body.hbs index a709d396cacfc1b98dc3aea94da6d753eefceadb..16190a8ae3982de828c6b0df13048367c36e073b 100644 --- a/lib/config/templates/node/pr-body.hbs +++ b/lib/config/templates/node/pr-body.hbs @@ -29,7 +29,3 @@ Please make sure the following warnings are safe to ignore: - `{{warning.depName}}`: {{warning.message}} {{/each}} {{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/workers/global/index.js b/lib/workers/global/index.js index 99ff09c21360742e3c935221d9ce362cf75a0a74..4c4fcdaeaed56e7519e5a0e6a68efddbe5fdebfa 100644 --- a/lib/workers/global/index.js +++ b/lib/workers/global/index.js @@ -26,7 +26,7 @@ async function start() { ); } // Move global variables that we need to use later - const importGlobals = ['exposeEnv', 'prBanner']; + const importGlobals = ['exposeEnv', 'prBanner', 'prFooter']; config.global = {}; importGlobals.forEach(key => { config.global[key] = config[key]; diff --git a/lib/workers/pr/index.js b/lib/workers/pr/index.js index bdfcd9cb58a6417d1ca1475360853388874b94c6..33bc4afefcf85acd8812e92fe9006beb457a02bf 100644 --- a/lib/workers/pr/index.js +++ b/lib/workers/pr/index.js @@ -190,9 +190,15 @@ async function ensurePr(prConfig) { let prBody = handlebars.compile(config.prBody)(config); // istanbul ignore if - if (config.global && config.global.prBanner) { - prBody = config.global.prBanner + '\n\n' + prBody; + 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; + } } + prBody = prBody.trim(); if (config.isGitHub && !config.privateRepo) { // Put a zero width space after every # followed by a digit prBody = prBody.replace(/#(\d)/gi, '#​$1'); diff --git a/lib/workers/repository/onboarding/pr/index.js b/lib/workers/repository/onboarding/pr/index.js index 80b9707324626e82f7855c92addb121ac1b040a3..35840a29db96f2d47d5c15c6fffa54e99c7a02e4 100644 --- a/lib/workers/repository/onboarding/pr/index.js +++ b/lib/workers/repository/onboarding/pr/index.js @@ -43,8 +43,13 @@ async function ensureOnboardingPr(config) { prBody = prBody.replace('{{BASEBRANCH}}\n', getBaseBranchDesc(config)); prBody = prBody.replace('{{PRLIST}}\n', getPrList(config)); // istanbul ignore if - if (config.global && config.global.prBanner) { - prBody = config.global.prBanner + '\n\n' + prBody; + 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'; + } } logger.trace('prBody:\n' + prBody); diff --git a/test/config/__snapshots__/index.spec.js.snap b/test/config/__snapshots__/index.spec.js.snap index 0cb3db6a0dedeefb0823a78ad1c5ef237bed4328..4985f2587ceccf25e8b43613e915e5b11bcbe0ba 100644 --- a/test/config/__snapshots__/index.spec.js.snap +++ b/test/config/__snapshots__/index.spec.js.snap @@ -36,11 +36,7 @@ Please make sure the following warnings are safe to ignore: {{#each warnings as |warning|}} - \`{{warning.depName}}\`: {{warning.message}} {{/each}} -{{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +{{/if}}", "prTitle": "Lock file maintenance", "recreateClosed": true, "schedule": Array [ diff --git a/test/manager/__snapshots__/resolve.spec.js.snap b/test/manager/__snapshots__/resolve.spec.js.snap index 81567610c467352f555207f9e2e916b47a73533f..e7598cdcc7dfcc204ca54922cebcd93936372a7a 100644 --- a/test/manager/__snapshots__/resolve.spec.js.snap +++ b/test/manager/__snapshots__/resolve.spec.js.snap @@ -91,11 +91,7 @@ Please make sure the following warnings are safe to ignore: {{#each warnings as |warning|}} - \`{{warning.depName}}\`: {{warning.message}} {{/each}} -{{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +{{/if}}", "prTitle": "Update Dockerfile {{{depName}}} image {{{currentTag}}} digest ({{{newDigestShort}}})", }, "enabled": true, @@ -134,11 +130,7 @@ Please make sure the following warnings are safe to ignore: {{#each warnings as |warning|}} - \`{{warning.depName}}\`: {{warning.message}} {{/each}} -{{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +{{/if}}", "prTitle": "Update Docker {{{groupName}}} digests", }, "major": Object { @@ -185,11 +177,7 @@ Please make sure the following warnings are safe to ignore: {{#each warnings as |warning|}} - \`{{warning.depName}}\`: {{warning.message}} {{/each}} -{{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +{{/if}}", "prTitle": "Pin Docker digests", }, "groupName": "Pin Docker Digests", @@ -226,11 +214,7 @@ Please make sure the following warnings are safe to ignore: {{#each warnings as |warning|}} - \`{{warning.depName}}\`: {{warning.message}} {{/each}} -{{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +{{/if}}", "prTitle": "Pin Dockerfile {{{depName}}}:{{{currentTag}}} image digest", }, "prBody": "This Pull Request updates Docker base image \`{{{depName}}}\` from tag \`{{{currentTag}}}\` to new tag \`{{{newTag}}}\`. For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker @@ -263,11 +247,7 @@ Please make sure the following warnings are safe to ignore: {{#each warnings as |warning|}} - \`{{warning.depName}}\`: {{warning.message}} {{/each}} -{{/if}} - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +{{/if}}", "prTitle": "Update {{{depName}}} Dockerfile tag to {{#if isMajor}}v{{{newVersionMajor}}}{{else}}v{{{newTag}}}{{/if}}", }, Object { diff --git a/test/workers/pr/__snapshots__/index.spec.js.snap b/test/workers/pr/__snapshots__/index.spec.js.snap index 844397ef0cfa030cc3edbd58e4973f88868f6c1d..e48bde230c6f8c95dcefc7bb3853c9bbeafa3523 100644 --- a/test/workers/pr/__snapshots__/index.spec.js.snap +++ b/test/workers/pr/__snapshots__/index.spec.js.snap @@ -36,8 +36,7 @@ Array [ <ul> <li><a href=\\"https://github.com/renovateapp/dummy/commit/abcdefghijklmnopqrstuvwxyz\\"><code>abcdefg</code></a> foo <a href=\\"https://github.com/renovateapp/dummy/issues/3\\">#3</a></li> </ul> -<hr /> -<p>This MR has been generated by <a href=\\"https://renovateapp.com\\">Renovate Bot</a>.</p>", +<p></details></p>", Array [], false, false, @@ -59,13 +58,7 @@ Array [ #### v1.1.0 - [\`abcdefg\`](https://github.com/renovateapp/dummy/commit/abcdefghijklmnopqrstuvwxyz) foo [#3](https://github.com/renovateapp/dummy/issues/3) -</details> - - - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +</details>", Array [], false, false, @@ -87,13 +80,7 @@ Array [ #### v1.1.0 - [\`abcdefg\`](https://github.com/renovateapp/dummy/commit/abcdefghijklmnopqrstuvwxyz) foo #​3 -</details> - - - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +</details>", Array [], false, false, @@ -113,13 +100,7 @@ Object { #### v1.1.0 - [\`abcdefg\`](https://github.com/renovateapp/dummy/commit/abcdefghijklmnopqrstuvwxyz) foo [#3](https://github.com/renovateapp/dummy/issues/3) -</details> - - - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +</details>", "displayNumber": "Existing PR", "title": "Update dependency dummy to v1.1.0", } @@ -138,13 +119,7 @@ Object { #### v1.1.0 - [\`abcdefg\`](https://github.com/renovateapp/dummy/commit/abcdefghijklmnopqrstuvwxyz) foo [#3](https://github.com/renovateapp/dummy/issues/3) -</details> - - - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +</details>", "displayNumber": "Existing PR", "title": "wrong", } @@ -167,13 +142,7 @@ Array [ #### v1.1.0 - [\`abcdefg\`](https://github.com/renovateapp/dummy/commit/abcdefghijklmnopqrstuvwxyz) foo [#3](https://github.com/renovateapp/dummy/issues/3) - - - - ---- - -This PR has been generated by [Renovate Bot](https://renovateapp.com).", +", Array [], false, false, diff --git a/test/workers/pr/index.spec.js b/test/workers/pr/index.spec.js index 8464342e1f65e5e98b8a760dbc25cb53fc0244aa..7cc6320285dcfb50cbeb024f7a649511b5c47872 100644 --- a/test/workers/pr/index.spec.js +++ b/test/workers/pr/index.spec.js @@ -133,9 +133,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].indexOf('<p>This MR')).not.toBe( - -1 - ); + expect( + platform.createPr.mock.calls[0][2].indexOf('<p>This Merge Request') + ).not.toBe(-1); }); it('should strip HTML PR for vsts', async () => { platform.getBranchStatus.mockReturnValueOnce('success');