| 174 | } |
| 175 | |
| 176 | func 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 | |
| 195 | func ResolveWorkflow(p iprompter, io *iostreams.IOStreams, client *api.Client, repo ghrepo.Interface, prompt bool, workflowSelector string, states []WorkflowState) (*Workflow, error) { |
| 196 | if prompt { |