From 879966acdc50a64511c1befe60d8bcad8cb33230 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Mon, 24 Aug 2020 15:17:24 +0200 Subject: [PATCH] =?UTF-8?q?fix(github):=20don=E2=80=99t=20delete=20forked?= =?UTF-8?q?=20repos=20(#7079)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #7055 --- lib/platform/github/index.ts | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 301c5f1ed3..25930ccb44 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -355,6 +355,9 @@ export async function initRepo({ // This is a lovely "hack" by GitHub that lets us force update our fork's master // with the base commit from the parent repository try { + logger.debug( + 'Updating forked repository default sha to match upstream' + ); await githubApi.patchJson( `repos/${config.repository}/git/refs/heads/${config.defaultBranch}`, { @@ -366,22 +369,10 @@ export async function initRepo({ } ); } catch (err) /* istanbul ignore next */ { - logger.debug( - 'Error updating fork reference - will try deleting fork to try again next time' + logger.error( + { err: err.err || err }, + 'Error updating fork from upstream - cannot continue' ); - try { - await githubApi.deleteJson(`repos/${config.repository}`, { - token: forkToken || opts.token, - }); - logger.info('Fork deleted'); - if (is.nonEmptyArray(existingRepos)) { - existingRepos = existingRepos.filter( - (existingRepo) => existingRepo !== config.repository - ); - } - } catch (deleteErr) { - logger.warn({ err: deleteErr }, 'Could not delete fork'); - } if (err instanceof ExternalHostError) { throw err; } -- GitLab