From 9d0c0889737988228646a20bed40d4614c9730b2 Mon Sep 17 00:00:00 2001 From: Fabian Holler Date: Tue, 14 Jan 2025 18:32:58 +0100 Subject: [PATCH] github: return pull request in updated-asc order by ListPRs 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. --- internal/githubclt/listprs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/githubclt/listprs.go b/internal/githubclt/listprs.go index 2587c27..940202c 100644 --- a/internal/githubclt/listprs.go +++ b/internal/githubclt/listprs.go @@ -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. @@ -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