From 3b387e92db14336dc64c733862a754d1406f089e Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Fri, 5 Oct 2018 09:35:40 +0200 Subject: [PATCH] fix: skip gitFs if unrenovated fork --- lib/platform/github/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index 8264c019d0..749ab19d1e 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -132,6 +132,23 @@ async function initRepo({ res = await get(`repos/${repository}`); logger.trace({ repositoryDetails: res.body }, 'Repository details'); // istanbul ignore if + if (res.body.fork && gitFs) { + try { + const { renovateFork } = JSON.parse( + Buffer.from( + (await get(`repos/${config.repository}/contents/renovate.json`)) + .body.content, + 'base64' + ).toString() + ); + if (!renovateFork) { + throw new Error(); + } + } catch (err) { + throw new Error('fork'); + } + } + // istanbul ignore if if (res.body.full_name && res.body.full_name !== repository) { logger.info( { repository, this_repository: res.body.full_name }, @@ -179,6 +196,9 @@ async function initRepo({ if (err.message.startsWith('Repository access blocked')) { throw new Error('blocked'); } + if (err.message === 'fork') { + throw err; + } logger.info({ err }, 'Unknown GitHub initRepo error'); throw err; }