fix(gitFs): allow admin renovateFork override

This commit is contained in:
Rhys Arkins 2018-12-23 08:47:22 +02:00
parent 5b43931aab
commit 10d0f58c88

View file

@ -114,6 +114,7 @@ async function initRepo({
gitPrivateKey, gitPrivateKey,
gitFs, gitFs,
localDir, localDir,
renovateFork,
}) { }) {
logger.debug(`initRepo("${repository}")`); logger.debug(`initRepo("${repository}")`);
logger.info( logger.info(
@ -151,16 +152,16 @@ async function initRepo({
res = await get(`repos/${repository}`); res = await get(`repos/${repository}`);
logger.trace({ repositoryDetails: res.body }, 'Repository details'); logger.trace({ repositoryDetails: res.body }, 'Repository details');
// istanbul ignore if // istanbul ignore if
if (res.body.fork && gitFs) { if (res.body.fork && gitFs && !renovateFork) {
try { try {
const { renovateFork } = JSON.parse( const renovateConfig = JSON.parse(
Buffer.from( Buffer.from(
(await get(`repos/${config.repository}/contents/renovate.json`)) (await get(`repos/${config.repository}/contents/renovate.json`))
.body.content, .body.content,
'base64' 'base64'
).toString() ).toString()
); );
if (!renovateFork) { if (!renovateConfig.renovateFork) {
throw new Error(); throw new Error();
} }
} catch (err) { } catch (err) {