MCPcopy Index your code
hub / github.com/cli/cli / getWorkflowsByName

Function getWorkflowsByName

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

Source from the content-addressed store, hash-verified

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

Callers 2

FindWorkflowFunction · 0.85

Calls 3

FullNameFunction · 0.92
GetWorkflowsFunction · 0.85
ErrorfMethod · 0.65

Tested by 1