getWorkflowStatus gets the status of a single workflow by name
(workflowIdOrName string, repoOverride string, verbose bool)
| 176 | |
| 177 | // getWorkflowStatus gets the status of a single workflow by name |
| 178 | func getWorkflowStatus(workflowIdOrName string, repoOverride string, verbose bool) (*GitHubWorkflow, error) { |
| 179 | workflowsLog.Printf("Getting workflow status: workflow=%s", workflowIdOrName) |
| 180 | |
| 181 | // Extract workflow name for lookup |
| 182 | filename := strings.TrimSuffix(filepath.Base(workflowIdOrName), ".md") |
| 183 | |
| 184 | // Get all GitHub workflows |
| 185 | githubWorkflows, err := fetchGitHubWorkflows(repoOverride, verbose) |
| 186 | if err != nil { |
| 187 | return nil, fmt.Errorf("failed to fetch GitHub workflows: %w", err) |
| 188 | } |
| 189 | |
| 190 | // Find the workflow |
| 191 | if workflow, exists := githubWorkflows[filename]; exists { |
| 192 | return workflow, nil |
| 193 | } |
| 194 | |
| 195 | suggestions := []string{ |
| 196 | fmt.Sprintf("Run '%s status' to see all available workflows", string(constants.CLIExtensionPrefix)), |
| 197 | "Check if the workflow has been compiled and pushed to GitHub", |
| 198 | "Verify the workflow name matches the compiled .lock.yml file", |
| 199 | } |
| 200 | return nil, errors.New(console.FormatErrorWithSuggestions( |
| 201 | fmt.Sprintf("workflow '%s' not found on GitHub", workflowIdOrName), |
| 202 | suggestions, |
| 203 | )) |
| 204 | } |
| 205 | |
| 206 | // restoreWorkflowState restores a workflow to disabled state if it was previously disabled |
| 207 | func restoreWorkflowState(workflowIdOrName string, workflowID int64, repoOverride string, verbose bool) { |