MCPcopy Create free account
hub / github.com/cli/cli / GetRunsWithFilter

Function GetRunsWithFilter

pkg/cmd/run/shared/shared.go:349–366  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

347
348// GetRunsWithFilter fetches 50 runs from the API and filters them in-memory
349func 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
368func 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")

Callers 3

runRerunFunction · 0.92
watchRunFunction · 0.92
runCancelFunction · 0.92

Calls 1

GetRunsFunction · 0.85

Tested by

no test coverage detected