fix: list pulls using the correct head format (#2792)

This commit is contained in:
Peter Evans 2024-02-28 09:28:24 +09:00 committed by GitHub
parent 853c071bcf
commit a4f52f8033
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

3
dist/index.js vendored
View file

@ -1109,7 +1109,6 @@ class GitHubHelper {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const [headOwner] = headRepository.split('/'); const [headOwner] = headRepository.split('/');
const headBranch = `${headOwner}:${inputs.branch}`; const headBranch = `${headOwner}:${inputs.branch}`;
const headBranchFull = `${headRepository}:${inputs.branch}`;
// Try to create the pull request // Try to create the pull request
try { try {
core.info(`Attempting creation of pull request`); core.info(`Attempting creation of pull request`);
@ -1131,7 +1130,7 @@ class GitHubHelper {
} }
// Update the pull request that exists for this branch and base // Update the pull request that exists for this branch and base
core.info(`Fetching existing pull request`); 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`); 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 })); 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})`); core.info(`Updated pull request #${pull.number} (${headBranch} => ${inputs.base})`);

View file

@ -48,7 +48,6 @@ export class GitHubHelper {
): Promise<Pull> { ): Promise<Pull> {
const [headOwner] = headRepository.split('/') const [headOwner] = headRepository.split('/')
const headBranch = `${headOwner}:${inputs.branch}` const headBranch = `${headOwner}:${inputs.branch}`
const headBranchFull = `${headRepository}:${inputs.branch}`
// Try to create the pull request // Try to create the pull request
try { try {
@ -85,7 +84,7 @@ export class GitHubHelper {
const {data: pulls} = await this.octokit.rest.pulls.list({ const {data: pulls} = await this.octokit.rest.pulls.list({
...this.parseRepository(baseRepository), ...this.parseRepository(baseRepository),
state: 'open', state: 'open',
head: headBranchFull, head: headBranch,
base: inputs.base base: inputs.base
}) })
core.info(`Attempting update of pull request`) core.info(`Attempting update of pull request`)