Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: list pulls using the correct head format #2792

Merged
merged 1 commit into from Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions dist/index.js
Expand Up @@ -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`);
Expand All @@ -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})`);
Expand Down
3 changes: 1 addition & 2 deletions src/github-helper.ts
Expand Up @@ -48,7 +48,6 @@ export class GitHubHelper {
): Promise<Pull> {
const [headOwner] = headRepository.split('/')
const headBranch = `${headOwner}:${inputs.branch}`
const headBranchFull = `${headRepository}:${inputs.branch}`

// Try to create the pull request
try {
Expand Down Expand Up @@ -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`)
Expand Down