From bd1785558a5efb2ccb9d2ab72da0e84cfdb1098c Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Thu, 10 Jan 2019 12:40:56 +0100 Subject: [PATCH] refactor: appSlug for rebase --- lib/platform/bitbucket/index.js | 3 ++- lib/platform/vsts/index.js | 3 ++- lib/workers/branch/parent.js | 4 +++- lib/workers/pr/pr-body.js | 5 ++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/platform/bitbucket/index.js b/lib/platform/bitbucket/index.js index a9c8256cb9..55932383eb 100644 --- a/lib/platform/bitbucket/index.js +++ b/lib/platform/bitbucket/index.js @@ -2,6 +2,7 @@ const parseDiff = require('parse-diff'); const api = require('./bb-got-wrapper'); const utils = require('./utils'); const hostRules = require('../../util/host-rules'); +const { appSlug } = require('../../config/app-strings'); let config = {}; @@ -585,7 +586,7 @@ function getPrBody(input) { return input .replace(/<\/?summary>/g, '**') .replace(/<\/?details>/g, '') - .replace(/\n---\n\n.*?<!-- renovate-rebase -->.*?\n/, '') + .replace(new RegExp(`\n---\n\n.*?<!-- ${appSlug}-rebase -->.*?\n`), '') .substring(0, 50000); } diff --git a/lib/platform/vsts/index.js b/lib/platform/vsts/index.js index 8ed5a4f489..818a2fc241 100644 --- a/lib/platform/vsts/index.js +++ b/lib/platform/vsts/index.js @@ -2,6 +2,7 @@ const vstsHelper = require('./vsts-helper'); const vstsApi = require('./vsts-got-wrapper'); const hostRules = require('../../util/host-rules'); +const { appSlug } = require('../../config/app-strings'); const config = {}; @@ -519,7 +520,7 @@ async function mergePr(pr) { function getPrBody(input) { // Remove any HTML we use return input - .replace(/\n---\n\n.*?<!-- renovate-rebase -->.*?\n/, '') + .replace(new RegExp(`\n---\n\n.*?<!-- ${appSlug}-rebase -->.*?\n`), '') .replace('<summary>', '**') .replace('</summary>', '**') .replace('<details>', '') diff --git a/lib/workers/branch/parent.js b/lib/workers/branch/parent.js index 69f969c279..010087448b 100644 --- a/lib/workers/branch/parent.js +++ b/lib/workers/branch/parent.js @@ -1,3 +1,5 @@ +const { appSlug } = require('../../config/app-strings'); + module.exports = { getParentBranch, }; @@ -20,7 +22,7 @@ async function getParentBranch(config) { logger.info('Manual rebase requested via PR title for #' + pr.number); return { parentBranch: undefined }; } - if (pr.body && pr.body.includes('- [x] <!-- renovate-rebase -->')) { + if (pr.body && pr.body.includes(`- [x] <!-- ${appSlug}-rebase -->`)) { logger.info('Manual rebase requested via PR checkbox for #' + pr.number); return { parentBranch: undefined }; } diff --git a/lib/workers/pr/pr-body.js b/lib/workers/pr/pr-body.js index e9cbe1091b..8c76eee25f 100644 --- a/lib/workers/pr/pr-body.js +++ b/lib/workers/pr/pr-body.js @@ -4,7 +4,7 @@ const releaseNotesHbs = require('./changelog/hbs-template'); const versioning = require('../../versioning'); -const { appName, urls } = require('../../config/app-strings'); +const { appName, appSlug, urls } = require('../../config/app-strings'); handlebars.registerHelper('encodeURIComponent', encodeURIComponent); @@ -232,8 +232,7 @@ async function getPrBody(config) { config.upgrades.length === 1 ? 'this update' : 'these updates' } again.\n\n`; } - prBody += - '\n\n---\n\n - [ ] <!-- renovate-rebase -->If you want to rebase/retry this PR, check this box\n\n'; + prBody += `\n\n---\n\n - [ ] <!-- ${appSlug}-rebase -->If you want to rebase/retry this PR, check this box\n\n`; // istanbul ignore if if (config.global) { if (config.global.prBanner) { -- GitLab