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

Commit

Permalink
Ignore draft PRs outside of the project board
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Jan 29, 2021
1 parent c91f075 commit 8e50447
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 8e50447

Please sign in to comment.