@@ -356,8 +356,9 @@ function createPullRequest(inputs) {
356
356
core.endGroup();
357
357
core.startGroup('Determining the base and head repositories');
358
358
const baseRemote = gitConfigHelper.getGitRemote();
359
- // Init the GitHub client
360
- const githubHelper = new github_helper_1.GitHubHelper(baseRemote.hostname, inputs.token);
359
+ // Init the GitHub clients
360
+ const ghBranch = new github_helper_1.GitHubHelper(baseRemote.hostname, inputs.gitToken);
361
+ const ghPull = new github_helper_1.GitHubHelper(baseRemote.hostname, inputs.token);
361
362
// Determine the head repository; the target for the pull request branch
362
363
const branchRemoteName = inputs.pushToFork ? 'fork' : 'origin';
363
364
const branchRepository = inputs.pushToFork
@@ -366,8 +367,8 @@ function createPullRequest(inputs) {
366
367
if (inputs.pushToFork) {
367
368
// Check if the supplied fork is really a fork of the base
368
369
core.info(`Checking if '${branchRepository}' is a fork of '${baseRemote.repository}'`);
369
- const baseParentRepository = yield githubHelper .getRepositoryParent(baseRemote.repository);
370
- const branchParentRepository = yield githubHelper .getRepositoryParent(branchRepository);
370
+ const baseParentRepository = yield ghBranch .getRepositoryParent(baseRemote.repository);
371
+ const branchParentRepository = yield ghBranch .getRepositoryParent(branchRepository);
371
372
if (branchParentRepository == null) {
372
373
throw new Error(`Repository '${branchRepository}' is not a fork. Unable to continue.`);
373
374
}
@@ -469,7 +470,7 @@ function createPullRequest(inputs) {
469
470
// Create signed commits via the GitHub API
470
471
const stashed = yield git.stashPush(['--include-untracked']);
471
472
yield git.checkout(inputs.branch);
472
- const pushSignedCommitsResult = yield githubHelper .pushSignedCommits(result.branchCommits, result.baseSha, repoPath, branchRepository, inputs.branch);
473
+ const pushSignedCommitsResult = yield ghBranch .pushSignedCommits(result.branchCommits, result.baseSha, repoPath, branchRepository, inputs.branch);
473
474
outputs.set('pull-request-head-sha', pushSignedCommitsResult.sha);
474
475
outputs.set('pull-request-commits-verified', pushSignedCommitsResult.verified.toString());
475
476
yield git.checkout('-');
@@ -488,7 +489,7 @@ function createPullRequest(inputs) {
488
489
}
489
490
if (result.hasDiffWithBase) {
490
491
core.startGroup('Create or update the pull request');
491
- const pull = yield githubHelper .createOrUpdatePullRequest(inputs, baseRemote.repository, branchRepository);
492
+ const pull = yield ghPull .createOrUpdatePullRequest(inputs, baseRemote.repository, branchRepository);
492
493
outputs.set('pull-request-number', pull.number.toString());
493
494
outputs.set('pull-request-url', pull.html_url);
494
495
if (pull.created) {
0 commit comments