Skip to content

Commit

Permalink
fix: clean up queries
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-ae authored and gentlementlegen committed Aug 27, 2024
1 parent 535ec00 commit df7ff28
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/utils/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function getAssignedIssues(context: Context, username: string): Pro
try {
return await context.octokit
.paginate(context.octokit.search.issuesAndPullRequests, {
q: `org:${payload.repository.owner.login} assignee:${username} is:open`,
q: `org:${payload.repository.owner.login} assignee:${username} is:open is:issue`,
per_page: 100,
order: "desc",
sort: "created",
Expand All @@ -22,7 +22,6 @@ export async function getAssignedIssues(context: Context, username: string): Pro
issues.filter((issue) => {
return (
issue.state === "open" &&
!issue.pull_request &&
(issue.assignee?.login === username || issue.assignees?.some((assignee) => assignee.login === username))
);
})
Expand All @@ -33,6 +32,7 @@ export async function getAssignedIssues(context: Context, username: string): Pro
}
}


export async function addCommentToIssue(context: Context, message: string | null) {
const { payload, logger } = context;
if (!message) {
Expand Down Expand Up @@ -134,12 +134,16 @@ export async function addAssignees(context: Context, issueNo: number, assignees:
}
}

export async function getAllPullRequests(context: Context, state: "open" | "closed" | "all" = "open", username: string) {
export async function getAllPullRequests(
context: Context,
state: "open" | "closed" | "all" = "open",
username: string
) {
const { payload } = context;

try {
return (await context.octokit.paginate(context.octokit.search.issuesAndPullRequests, {
q: `org:${payload.repository.owner.login} author:${username} state:${state}`,
q: `org:${payload.repository.owner.login} author:${username} state:${state} is:pr`,
per_page: 100,
order: "desc",
sort: "created",
Expand Down

0 comments on commit df7ff28

Please sign in to comment.