Skip to content

Commit

Permalink
github: omit draft pull requets in ListPRs result
Browse files Browse the repository at this point in the history
We are not interested in draft pull requests, they are not added to the
queue.
Search only for non-draft pull-requests in ListPRs.
  • Loading branch information
fho committed Jan 14, 2025
1 parent 9d0c088 commit ca31449
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/githubclt/listprs.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ type listPRsQuery struct {
} `graphql:"search(query:$query, type:ISSUE, first:100, after:$pullRequestCursor)"`
}

// ListPRs returns an iterator over all open pull requests of the repository.
// ListPRs returns an iterator over all open non-draft pull requests of the
// repository.
// If an error happens when querying the GitHub GraphQL API, it is passed as
// second argument to the iterator.
func (clt *Client) ListPRs(ctx context.Context, owner, repo string) iter.Seq2[*PR, error] {
vars := map[string]any{
"pullRequestCursor": (*githubv4.String)(nil),
"query": githubv4.String(fmt.Sprintf("repo:%s/%s is:pr is:open sort:updated-asc", owner, repo)),
"query": githubv4.String(fmt.Sprintf("repo:%s/%s is:pr is:open draft:false sort:updated-asc", owner, repo)),
}

var prs []*PR
Expand Down

0 comments on commit ca31449

Please sign in to comment.