Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/infrastructure/github/OctokitGitHubClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export class OctokitGitHubClient implements GitHubClient {
milestone: milestoneId as unknown as string,
state: "all",
});
return data.map((d) => this.mapIssue(d));
const filteredIssues = data.filter((item) => !item.pull_request);
return filteredIssues.map((d) => this.mapIssue(d));
}

async createBranch(name: string, fromBranch: string): Promise<void> {
Expand Down
30 changes: 30 additions & 0 deletions tests/infrastructure/OctokitGitHubClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,36 @@ describe("OctokitGitHubClient", () => {
);
});

it("should exclude pull requests from listIssues results", async () => {
mockOctokit.issues.listForRepo.mockResolvedValueOnce({
data: [
{
id: 1,
number: 1,
title: "Real Issue",
body: "An actual issue",
labels: [{ name: "bug" }],
milestone: null,
},
{
id: 2,
number: 2,
title: "A Pull Request",
body: "A PR masquerading as issue",
labels: [],
milestone: null,
pull_request: { url: "https://api.github.com/repos/owner/repo/pulls/2" },
},
],
});

const result = await client.listIssues();

expect(result).toHaveLength(1);
expect(result[0].number).toBe(1);
expect(result[0].title).toBe("Real Issue");
});

it("should create branch by fetching SHA first then creating ref", async () => {
mockOctokit.git.getRef.mockResolvedValueOnce({
data: { object: { sha: "abc123" } },
Expand Down