From 2ba1250abc7b2ed9ab18c18131eac83413e9e02a Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:28:24 +0900 Subject: [PATCH] fix: list pulls using the correct head format (#2792) --- dist/index.js | 3 +-- src/github-helper.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 1089e1650..bca7be4f4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1109,7 +1109,6 @@ class GitHubHelper { return __awaiter(this, void 0, void 0, function* () { const [headOwner] = headRepository.split('/'); const headBranch = `${headOwner}:${inputs.branch}`; - const headBranchFull = `${headRepository}:${inputs.branch}`; // Try to create the pull request try { core.info(`Attempting creation of pull request`); @@ -1131,7 +1130,7 @@ class GitHubHelper { } // Update the pull request that exists for this branch and base core.info(`Fetching existing pull request`); - const { data: pulls } = yield this.octokit.rest.pulls.list(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { state: 'open', head: headBranchFull, base: inputs.base })); + const { data: pulls } = yield this.octokit.rest.pulls.list(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { state: 'open', head: headBranch, base: inputs.base })); core.info(`Attempting update of pull request`); const { data: pull } = yield this.octokit.rest.pulls.update(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { pull_number: pulls[0].number, title: inputs.title, body: inputs.body })); core.info(`Updated pull request #${pull.number} (${headBranch} => ${inputs.base})`); diff --git a/src/github-helper.ts b/src/github-helper.ts index 850c6ef3d..d880cfb60 100644 --- a/src/github-helper.ts +++ b/src/github-helper.ts @@ -48,7 +48,6 @@ export class GitHubHelper { ): Promise { const [headOwner] = headRepository.split('/') const headBranch = `${headOwner}:${inputs.branch}` - const headBranchFull = `${headRepository}:${inputs.branch}` // Try to create the pull request try { @@ -85,7 +84,7 @@ export class GitHubHelper { const {data: pulls} = await this.octokit.rest.pulls.list({ ...this.parseRepository(baseRepository), state: 'open', - head: headBranchFull, + head: headBranch, base: inputs.base }) core.info(`Attempting update of pull request`)