From 4121350eaa30fbe4bf62bd6686c7316c83c3e4f7 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sun, 18 Mar 2018 06:46:01 +0100 Subject: [PATCH] fix: use renovate-config as onboarding base branch for mirror mode --- lib/platform/github/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index ba1068bbce..6f8b494bab 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -208,6 +208,7 @@ async function initRepo({ // istanbul ignore if if (mirrorMode) { logger.info('Renovate is in mirrorMode'); + config.mirrorMode = true; const parentRepo = res.body.parent.full_name; logger.debug('Parent repo is ' + parentRepo); const parentDefaultBranch = (await get(`repos/${repository}`)).body @@ -764,7 +765,16 @@ async function createPr( useDefaultBranch, statusCheckVerify ) { - const base = useDefaultBranch ? config.defaultBranch : config.baseBranch; + let base = useDefaultBranch ? config.defaultBranch : config.baseBranch; + // istanbul ignore if + if (config.mirrorMode && branchName === 'renovate/configure') { + logger.debug('Using renovate-config as base branch for mirror config'); + if (!await branchExists('renovate-config')) { + const baseCommitSHA = await getBaseCommitSHA(); + await createBranch('renovate-config', baseCommitSHA); + } + base = 'renovate-config'; + } // Include the repository owner to handle forkMode and regular mode const head = `${config.repository.split('/')[0]}:${branchName}`; const options = { -- GitLab