Skip to content

Commit

Permalink
Switching commitsWithPathChanges to paginate(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
Devon Stewart committed Mar 2, 2022
1 parent dca6a04 commit 32712f8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/commits.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,18 @@ const findCommitsWithAssociatedPullRequests = async ({
includedIds = {}

if (includePaths.length > 0) {
const commitsWithPathChanges = await context.octokit.graphql(
const commitsWithPathChanges = await paginate(
context.octokit.graphql,
findCommitsWithPathChangesQuery({
includePaths,
}),
lastRelease ? { ...variables, since: lastRelease.created_at } : variables
lastRelease ? { ...variables, since: lastRelease.created_at } : variables,
['repository', 'object']
)

var anyChanges = false
for (const [idx, path] of includePaths.entries()) {
const { nodes } = _.get(commitsWithPathChanges, [
'repository',
'object',
`path${idx}`,
])
const { nodes } = commitsWithPathChanges[`path${idx}`]
includedIds[path] = includedIds[path] || new Set([])
for (const { id } of nodes) {
anyChanges = true
Expand Down

0 comments on commit 32712f8

Please sign in to comment.