Skip to content

Commit

Permalink
github: return pull request in updated-asc order by ListPRs
Browse files Browse the repository at this point in the history
Return the pull request by ListPRs in ascending updated order.
This has the effect that on directorius startup the PR that has been
updated the longest time ago will become #1 instead of a random PR.
  • Loading branch information
fho committed Jan 14, 2025
1 parent 2450eba commit 9d0c088
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/githubclt/listprs.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type listPRsQuery struct {
}
} `graphql:"... on PullRequest"`
}
} `graphql:"search(query: $query, type: ISSUE, first: 100, after: $pullRequestCursor)"`
} `graphql:"search(query:$query, type:ISSUE, first:100, after:$pullRequestCursor)"`
}

// ListPRs returns an iterator over all open pull requests of the repository.
Expand All @@ -74,7 +74,7 @@ type listPRsQuery struct {
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", owner, repo)),
"query": githubv4.String(fmt.Sprintf("repo:%s/%s is:pr is:open sort:updated-asc", owner, repo)),
}

var prs []*PR
Expand Down

0 comments on commit 9d0c088

Please sign in to comment.