From 6a0fade7f90daf9861e04f02649ee8a4ca64ed92 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Tue, 1 Sep 2020 17:09:11 +0200 Subject: [PATCH] refactor: drop defaultBranchSha from platform/github --- lib/platform/github/index.ts | 11 +---------- lib/platform/github/types.ts | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 54ca05b44b..3b6c1a8146 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -258,7 +258,6 @@ export async function initRepo({ } // Use default branch as PR target unless later overridden. config.defaultBranch = repo.defaultBranchRef.name; - config.defaultBranchSha = repo.defaultBranchRef.target.oid; // Base branch may be configured but defaultBranch is always fixed logger.debug(`${repository} default branch = ${config.defaultBranch}`); // GitHub allows administrators to block certain types of merge, so we need to check it @@ -344,14 +343,6 @@ export async function initRepo({ { repository_fork: config.repository }, 'Found existing fork' ); - // Need to update base branch - logger.debug( - { - defaultBranch: config.defaultBranch, - defaultBranchSha: config.defaultBranchSha, - }, - 'Setting defaultBranch ref in fork' - ); // 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 { @@ -362,7 +353,7 @@ export async function initRepo({ `repos/${config.repository}/git/refs/heads/${config.defaultBranch}`, { body: { - sha: config.defaultBranchSha, + sha: repo.defaultBranchRef.target.oid, force: true, }, token: forkToken || opts.token, diff --git a/lib/platform/github/types.ts b/lib/platform/github/types.ts index d2e868c1f1..fe009d1923 100644 --- a/lib/platform/github/types.ts +++ b/lib/platform/github/types.ts @@ -56,7 +56,6 @@ export interface LocalRepoConfig { issueList: any[] | null; mergeMethod: string; defaultBranch: string; - defaultBranchSha?: string; repositoryOwner: string; repository: string | null; localDir: string; -- GitLab