From 34418825dfac97bc91e287845d68e8a6962fe881 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sat, 27 Feb 2021 09:06:39 +0100 Subject: [PATCH] fix(forkMode): use forkToken when changing default branch --- lib/platform/github/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 1533d7ab28..0450a4c20f 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -324,7 +324,7 @@ export async function initRepo({ try { await githubApi.postJson(`repos/${config.repository}/git/refs`, { body, - token: forkToken || opts.token, + token: forkToken, }); logger.debug('Created new default branch in fork'); } catch (err) /* istanbul ignore next */ { @@ -334,7 +334,7 @@ export async function initRepo({ ); } else { logger.warn( - { err }, + { err, body: err.response?.body }, 'Could not create parent defaultBranch in fork' ); } @@ -348,6 +348,7 @@ export async function initRepo({ name: config.repository.split('/')[1], default_branch: config.defaultBranch, }, + token: forkToken, }); logger.debug('Successfully changed default branch for fork'); } catch (err) /* istanbul ignore next */ { -- GitLab