diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 54ca05b44b47f036b5f1bbb73f606449b95dfede..3b6c1a81463dadcda7c9126f2eedc6fadd41f716 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 d2e868c1f19c89956f3aca204990279bb03b4ed0..fe009d192385797940c86ba07228388da225a07e 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;