Skip to content

Commit

Permalink
build: update dist
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-evans committed Sep 29, 2023
1 parent 7d12277 commit ffd8349
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
});
Expand Down

0 comments on commit ffd8349

Please sign in to comment.