Skip to content

Commit

Permalink
Now trying smaller page sizes when fetching files from git repoo for …
Browse files Browse the repository at this point in the history
…change detections (#613)
  • Loading branch information
joecroninallen authored Mar 7, 2023
1 parent ef8ec4e commit 263a80f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions contrib/git-changes-action/detector/ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ func getChangedFilesFromAPI(ctx context.Context, ghContext *actionscore.Context,
ct = tree.NewTree()

page := 1
perPage := 20
for {
files, res, err := client.PullRequests.ListFiles(ctx, repoOwner, repoName, prNumber, &github.ListOptions{
Page: page,
PerPage: 300,
PerPage: perPage,
})
if err != nil {
return nil, fmt.Errorf("could not get files: %w", err)
return nil, fmt.Errorf("could not get files for repoOwner %s, repoName %s, prNumber %d, page number %d with page size %d: %w",
repoOwner, repoName, prNumber, page, perPage, err)
}

for _, file := range files {
Expand Down

0 comments on commit 263a80f

Please sign in to comment.