refactor: drop defaultBranchSha from platform/github

This commit is contained in:
Rhys Arkins 2020-09-01 17:09:11 +02:00
parent 539312645c
commit 6a0fade7f9
2 changed files with 1 additions and 11 deletions

View file

@ -258,7 +258,6 @@ export async function initRepo({
} }
// Use default branch as PR target unless later overridden. // Use default branch as PR target unless later overridden.
config.defaultBranch = repo.defaultBranchRef.name; config.defaultBranch = repo.defaultBranchRef.name;
config.defaultBranchSha = repo.defaultBranchRef.target.oid;
// Base branch may be configured but defaultBranch is always fixed // Base branch may be configured but defaultBranch is always fixed
logger.debug(`${repository} default branch = ${config.defaultBranch}`); logger.debug(`${repository} default branch = ${config.defaultBranch}`);
// GitHub allows administrators to block certain types of merge, so we need to check it // 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 }, { repository_fork: config.repository },
'Found existing fork' '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 // This is a lovely "hack" by GitHub that lets us force update our fork's master
// with the base commit from the parent repository // with the base commit from the parent repository
try { try {
@ -362,7 +353,7 @@ export async function initRepo({
`repos/${config.repository}/git/refs/heads/${config.defaultBranch}`, `repos/${config.repository}/git/refs/heads/${config.defaultBranch}`,
{ {
body: { body: {
sha: config.defaultBranchSha, sha: repo.defaultBranchRef.target.oid,
force: true, force: true,
}, },
token: forkToken || opts.token, token: forkToken || opts.token,

View file

@ -56,7 +56,6 @@ export interface LocalRepoConfig {
issueList: any[] | null; issueList: any[] | null;
mergeMethod: string; mergeMethod: string;
defaultBranch: string; defaultBranch: string;
defaultBranchSha?: string;
repositoryOwner: string; repositoryOwner: string;
repository: string | null; repository: string | null;
localDir: string; localDir: string;