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

Function getWorkflowsByName

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

Source from the content-addressed store, hash-verified

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

Callers 2

FindWorkflowFunction · 0.85

Calls 4

FullNameFunction · 0.92
GetWorkflowsFunction · 0.85
ContainsMethod · 0.80
ErrorfMethod · 0.65

Tested by 1