Skip to content

Commit

Permalink
fix base option from head option with org: (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
darai0512 authored May 2, 2024
1 parent adb2426 commit 16c18d4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/github-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default class GithubClient {

return await this.get(this.pullRequestEndpoint(), {
state: "closed",
base: this.head,
base: this.head.split(":").at(-1),
per_page: 100,
sort: "updated",
direction: "desc",
Expand Down
26 changes: 26 additions & 0 deletions test/github-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,32 @@ describe("GithubClient", function () {
});
});

describe("#collectReleasePRs(): head option with `org:`", function () {
nock("https://api.github.com")
.get("/repos/uiureo/awesome-app/pulls/42/commits")
.query(true)
.reply(200, [])
.get(
"/repos/uiureo/awesome-app/pulls?state=closed&base=branch&per_page=100&sort=updated&direction=desc"
)
.reply(200, []);

it("returns prs that is going to be released", function (done) {
const client = new GithubClient({
owner: "uiureo",
repo: "awesome-app",
head: "org:branch",
});
client
.collectReleasePRs({ number: 42 })
.then(function (prs) {
assert(prs.length === 0);
done();
})
.catch(done);
});
});

describe("#assignReviewers()", function () {
const USER1 = "pr1-owner";
const USER2 = "pr2-owner";
Expand Down

0 comments on commit 16c18d4

Please sign in to comment.