fix: skip gitFs if unrenovated fork

This commit is contained in:
Rhys Arkins 2018-10-05 09:35:40 +02:00
parent 9bfa8e120b
commit 3b387e92db

View file

@ -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;
}