Skip to content

Commit e8d799a

Browse files
authored
Merge pull request #47 from joperezr/BackportHeadFormat
fix: list pulls using the correct head format (peter-evans#2792)
2 parents 9bfcafb + 810d7d0 commit e8d799a

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

dist/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,6 @@ class GitHubHelper {
10071007
return __awaiter(this, void 0, void 0, function* () {
10081008
const [headOwner] = headRepository.split('/');
10091009
const headBranch = `${headOwner}:${inputs.branch}`;
1010-
const headBranchFull = `${headRepository}:${inputs.branch}`;
10111010
// Try to create the pull request
10121011
try {
10131012
core.info(`Attempting creation of pull request`);
@@ -1029,7 +1028,7 @@ class GitHubHelper {
10291028
}
10301029
// Update the pull request that exists for this branch and base
10311030
core.info(`Fetching existing pull request`);
1032-
const { data: pulls } = yield this.octokit.rest.pulls.list(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { state: 'open', head: headBranchFull, base: inputs.base }));
1031+
const { data: pulls } = yield this.octokit.rest.pulls.list(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { state: 'open', head: headBranch, base: inputs.base }));
10331032
core.info(`Attempting update of pull request`);
10341033
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 }));
10351034
core.info(`Updated pull request #${pull.number} (${headBranch} => ${inputs.base})`);

src/github-helper.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export class GitHubHelper {
4444
): Promise<Pull> {
4545
const [headOwner] = headRepository.split('/')
4646
const headBranch = `${headOwner}:${inputs.branch}`
47-
const headBranchFull = `${headRepository}:${inputs.branch}`
4847

4948
// Try to create the pull request
5049
try {
@@ -80,7 +79,7 @@ export class GitHubHelper {
8079
const {data: pulls} = await this.octokit.rest.pulls.list({
8180
...this.parseRepository(baseRepository),
8281
state: 'open',
83-
head: headBranchFull,
82+
head: headBranch,
8483
base: inputs.base
8584
})
8685
core.info(`Attempting update of pull request`)

0 commit comments

Comments
 (0)