MCPcopy
hub / github.com/cli/cli / GetRunsWithFilter

Function GetRunsWithFilter

pkg/cmd/run/shared/shared.go:344–361  ·  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

342
343// GetRunsWithFilter fetches 50 runs from the API and filters them in-memory
344func GetRunsWithFilter(client *api.Client, repo ghrepo.Interface, opts *FilterOptions, limit int, f func(Run) bool) ([]Run, error) {
345 runs, err := GetRuns(client, repo, opts, 50)
346 if err != nil {
347 return nil, err
348 }
349
350 var filtered []Run
351 for _, run := range runs.WorkflowRuns {
352 if f(run) {
353 filtered = append(filtered, run)
354 }
355 if len(filtered) == limit {
356 break
357 }
358 }
359
360 return filtered, nil
361}
362
363func GetRuns(client *api.Client, repo ghrepo.Interface, opts *FilterOptions, limit int) (*RunsPayload, error) {
364 path := fmt.Sprintf("repos/%s/actions/runs", ghrepo.FullName(repo))

Callers 3

runRerunFunction · 0.92
watchRunFunction · 0.92
runCancelFunction · 0.92

Calls 1

GetRunsFunction · 0.85

Tested by

no test coverage detected