Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Ignore draft PRs outside of the project board #353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions src/queries/all-open-prs-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ query GetAllOpenPRsAndCardIDs($endCursor: String) {
id
pullRequests(states: OPEN, orderBy: { field: UPDATED_AT, direction: DESC }, first: 100, after: $endCursor) {
nodes {
isDraft
number
projectCards(first: 100) { nodes { id } }
}
Expand All @@ -30,9 +31,9 @@ export async function getAllOpenPRsAndCardIDs() {
fetchPolicy: "no-cache",
variables: { endCursor }
});
prNumbers.push(...noNullish(result.data.repository?.pullRequests.nodes).map(pr => pr.number));
prNumbers.push(...noNullish(result.data.repository?.pullRequests.nodes).filter(pr => !pr.isDraft).map(pr => pr.number));
for (const pr of noNullish(result.data.repository?.pullRequests.nodes)) {
cardIDs.push(...noNullish(pr.projectCards.nodes).map(card => card.id));
if (!pr.isDraft) cardIDs.push(...noNullish(pr.projectCards.nodes).map(card => card.id));
}
if (!result.data.repository?.pullRequests.pageInfo.hasNextPage) {
return { prNumbers, cardIDs };
Expand Down
4 changes: 4 additions & 0 deletions src/queries/schema/GetAllOpenPRsAndCardIDs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export interface GetAllOpenPRsAndCardIDs_repository_pullRequests_nodes_projectCa

export interface GetAllOpenPRsAndCardIDs_repository_pullRequests_nodes {
__typename: "PullRequest";
/**
* Identifies if the pull request is a draft.
*/
isDraft: boolean;
/**
* Identifies the pull request number.
*/
Expand Down