Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflows: Fix per page limit to 100 as it is max supported value #322

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/github/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ func GetWorkflows(ctx context.Context, client models.Client, opts models.ListWor
}

// Fetch this many workflows per page because this API endpoint does not allow filtering by time.
// It's unlikely a repository will have more workflows than this.
data, _, err := client.ListWorkflows(ctx, opts.Owner, opts.Repository, &github.ListOptions{Page: 0, PerPage: 1000})
// 100 is the maximum number of workflows that can be retrieved per request as specified in the GitHub API documentation.
// Also, it's unlikely a repository will have more workflows than this.
data, _, err := client.ListWorkflows(ctx, opts.Owner, opts.Repository, &github.ListOptions{Page: 1, PerPage: 100})
if err != nil {
return nil, fmt.Errorf("listing workflows: opts=%+v %w", opts, err)
}
Expand Down
Loading