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

Function getWorkflowsByName

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

Source from the content-addressed store, hash-verified

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

Callers 2

FindWorkflowFunction · 0.85

Calls 4

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

Tested by 1