MCPcopy Create free account
hub / github.com/github/gh-aw / getWorkflowStatus

Function getWorkflowStatus

pkg/cli/workflows.go:178–204  ·  view source on GitHub ↗

getWorkflowStatus gets the status of a single workflow by name

(workflowIdOrName string, repoOverride string, verbose bool)

Source from the content-addressed store, hash-verified

176
177// getWorkflowStatus gets the status of a single workflow by name
178func 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
207func restoreWorkflowState(workflowIdOrName string, workflowID int64, repoOverride string, verbose bool) {

Callers 2

TestGetWorkflowStatusFunction · 0.85
RunWorkflowOnGitHubFunction · 0.85

Calls 4

fetchGitHubWorkflowsFunction · 0.85
PrintfMethod · 0.45
ErrorfMethod · 0.45

Tested by 1

TestGetWorkflowStatusFunction · 0.68