Skip to content

Commit

Permalink
fix: ordering for pull request (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
bonyuta0204 authored Dec 9, 2023
1 parent 406f112 commit 8e8a49b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/github/pulls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ const GET_PULL_REQUESTS = gql(/* GraphQL */ `
) {
repository(name: $repoName, owner: $repoOwner) {
id
pullRequests(last: $limit, before: $cursor) {
pullRequests(
first: $limit
after: $cursor
orderBy: { field: CREATED_AT, direction: DESC }
) {
totalCount
edges {
node {
Expand All @@ -33,8 +37,8 @@ const GET_PULL_REQUESTS = gql(/* GraphQL */ `
}
}
pageInfo {
hasPreviousPage
startCursor
hasNextPage
endCursor
}
}
}
Expand Down Expand Up @@ -65,11 +69,9 @@ export async function getPullRequestStats(
(edge) => edge?.node
) ?? [],
cursor:
response.data.repository?.pullRequests.pageInfo.startCursor ??
undefined,
response.data.repository?.pullRequests.pageInfo.endCursor ?? undefined,
hasNext:
response.data.repository?.pullRequests.pageInfo.hasPreviousPage ??
false,
response.data.repository?.pullRequests.pageInfo.hasNextPage ?? false,
totalCount: response.data.repository?.pullRequests.totalCount
}
})
Expand Down

0 comments on commit 8e8a49b

Please sign in to comment.