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

Commit 8e50447

Browse files
committed
Ignore draft PRs outside of the project board
1 parent c91f075 commit 8e50447

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/queries/all-open-prs-query.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ query GetAllOpenPRsAndCardIDs($endCursor: String) {
99
id
1010
pullRequests(states: OPEN, orderBy: { field: UPDATED_AT, direction: DESC }, first: 100, after: $endCursor) {
1111
nodes {
12+
isDraft
1213
number
1314
projectCards(first: 100) { nodes { id } }
1415
}
@@ -30,9 +31,9 @@ export async function getAllOpenPRsAndCardIDs() {
3031
fetchPolicy: "no-cache",
3132
variables: { endCursor }
3233
});
33-
prNumbers.push(...noNullish(result.data.repository?.pullRequests.nodes).map(pr => pr.number));
34+
prNumbers.push(...noNullish(result.data.repository?.pullRequests.nodes).filter(pr => !pr.isDraft).map(pr => pr.number));
3435
for (const pr of noNullish(result.data.repository?.pullRequests.nodes)) {
35-
cardIDs.push(...noNullish(pr.projectCards.nodes).map(card => card.id));
36+
if (!pr.isDraft) cardIDs.push(...noNullish(pr.projectCards.nodes).map(card => card.id));
3637
}
3738
if (!result.data.repository?.pullRequests.pageInfo.hasNextPage) {
3839
return { prNumbers, cardIDs };

src/queries/schema/GetAllOpenPRsAndCardIDs.ts

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export interface GetAllOpenPRsAndCardIDs_repository_pullRequests_nodes_projectCa
2222

2323
export interface GetAllOpenPRsAndCardIDs_repository_pullRequests_nodes {
2424
__typename: "PullRequest";
25+
/**
26+
* Identifies if the pull request is a draft.
27+
*/
28+
isDraft: boolean;
2529
/**
2630
* Identifies the pull request number.
2731
*/

0 commit comments

Comments
 (0)