GetRunsWithFilter fetches 50 runs from the API and filters them in-memory
(client *api.Client, repo ghrepo.Interface, opts *FilterOptions, limit int, f func(Run) bool)
| 347 | |
| 348 | // GetRunsWithFilter fetches 50 runs from the API and filters them in-memory |
| 349 | func GetRunsWithFilter(client *api.Client, repo ghrepo.Interface, opts *FilterOptions, limit int, f func(Run) bool) ([]Run, error) { |
| 350 | runs, err := GetRuns(client, repo, opts, 50) |
| 351 | if err != nil { |
| 352 | return nil, err |
| 353 | } |
| 354 | |
| 355 | var filtered []Run |
| 356 | for _, run := range runs.WorkflowRuns { |
| 357 | if f(run) { |
| 358 | filtered = append(filtered, run) |
| 359 | } |
| 360 | if len(filtered) == limit { |
| 361 | break |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | return filtered, nil |
| 366 | } |
| 367 | |
| 368 | func GetRuns(client *api.Client, repo ghrepo.Interface, opts *FilterOptions, limit int) (*RunsPayload, error) { |
| 369 | u, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "actions", "runs") |