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

Function getWorkflowsByName

pkg/cmd/workflow/shared/shared.go:178–198  ·  view source on GitHub ↗
(client *api.Client, repo ghrepo.Interface, name string, states []WorkflowState)

Source from the content-addressed store, hash-verified

176}
177
178func getWorkflowsByName(client *api.Client, repo ghrepo.Interface, name string, states []WorkflowState) ([]Workflow, error) {
179 workflows, err := GetWorkflows(client, repo, 0)
180 if err != nil {
181 return nil, fmt.Errorf("couldn't fetch workflows for %s: %w", ghrepo.FullName(repo), err)
182 }
183
184 var filtered []Workflow
185 for _, workflow := range workflows {
186 if !strings.EqualFold(workflow.Name, name) {
187 continue
188 }
189 for _, state := range states {
190 if workflow.State == state {
191 filtered = append(filtered, workflow)
192 break
193 }
194 }
195 }
196
197 return filtered, nil
198}
199
200func ResolveWorkflow(p iprompter, io *iostreams.IOStreams, client *api.Client, repo ghrepo.Interface, prompt bool, workflowSelector string, states []WorkflowState) (*Workflow, error) {
201 if prompt {

Callers 2

FindWorkflowFunction · 0.85

Calls 3

FullNameFunction · 0.92
GetWorkflowsFunction · 0.85
ErrorfMethod · 0.65

Tested by 1