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

Function fetchLocalWorkflow

pkg/cli/fetch.go:65–85  ·  view source on GitHub ↗

fetchLocalWorkflow reads a workflow file from the local filesystem

(spec *WorkflowSpec, verbose bool)

Source from the content-addressed store, hash-verified

63
64// fetchLocalWorkflow reads a workflow file from the local filesystem
65func fetchLocalWorkflow(spec *WorkflowSpec, verbose bool) (*FetchedWorkflow, error) {
66 remoteWorkflowLog.Printf("Reading local workflow: %s", spec.WorkflowPath)
67
68 if verbose {
69 fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Reading local workflow: "+spec.WorkflowPath))
70 }
71
72 content, err := os.ReadFile(spec.WorkflowPath)
73 if err != nil {
74 return nil, fmt.Errorf("local workflow '%s' not found: %w", spec.WorkflowPath, err)
75 }
76
77 remoteWorkflowLog.Printf("Read local workflow: bytes=%d", len(content))
78
79 return &FetchedWorkflow{
80 Content: content,
81 CommitSHA: "", // Local workflows don't have a commit SHA
82 IsLocal: true,
83 SourcePath: spec.WorkflowPath,
84 }, nil
85}
86
87// fetchRemoteWorkflow fetches a workflow file directly from GitHub using the API
88func fetchRemoteWorkflow(ctx context.Context, spec *WorkflowSpec, verbose bool) (*FetchedWorkflow, error) {

Calls 3

FormatInfoMessageFunction · 0.92
PrintfMethod · 0.45
ErrorfMethod · 0.45