From 85246161a0f52c3badcc0972d3b97665cea88157 Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Fri, 29 Sep 2023 16:26:05 +0100 Subject: [PATCH] build: update dist --- dist/index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index ef00255..1c84bf4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -363,9 +363,14 @@ function createPullRequest(inputs) { if (inputs.pushToFork) { // Check if the supplied fork is really a fork of the base core.info(`Checking if '${branchRepository}' is a fork of '${baseRemote.repository}'`); - const parentRepository = yield githubHelper.getRepositoryParent(branchRepository); - if (parentRepository != baseRemote.repository) { - throw new Error(`Repository '${branchRepository}' is not a fork of '${baseRemote.repository}'. Unable to continue.`); + const baseParentRepository = yield githubHelper.getRepositoryParent(baseRemote.repository); + const branchParentRepository = yield githubHelper.getRepositoryParent(branchRepository); + if (branchParentRepository == null) { + throw new Error(`Repository '${branchRepository}' is not a fork. Unable to continue.`); + } + if (branchParentRepository != baseRemote.repository && + baseParentRepository != branchParentRepository) { + throw new Error(`Repository '${branchRepository}' is not a fork of '${baseRemote.repository}', nor are they siblings. Unable to continue.`); } // Add a remote for the fork const remoteUrl = utils.getRemoteUrl(baseRemote.protocol, baseRemote.hostname, branchRepository); @@ -1104,7 +1109,7 @@ class GitHubHelper { return __awaiter(this, void 0, void 0, function* () { const { data: headRepo } = yield this.octokit.rest.repos.get(Object.assign({}, this.parseRepository(headRepository))); if (!headRepo.parent) { - throw new Error(`Repository '${headRepository}' is not a fork. Unable to continue.`); + return null; } return headRepo.parent.full_name; });