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

Function FetchWorkflowFromSourceWithContext

pkg/cli/fetch.go:47–62  ·  view source on GitHub ↗

FetchWorkflowFromSourceWithContext fetches a workflow file from local disk or GitHub. The context is used to cancel remote ref resolution retries (for example, on Ctrl-C).

(ctx context.Context, spec *WorkflowSpec, verbose bool)

Source from the content-addressed store, hash-verified

45// FetchWorkflowFromSourceWithContext fetches a workflow file from local disk or GitHub.
46// The context is used to cancel remote ref resolution retries (for example, on Ctrl-C).
47func FetchWorkflowFromSourceWithContext(ctx context.Context, spec *WorkflowSpec, verbose bool) (*FetchedWorkflow, error) {
48 remoteWorkflowLog.Printf("Fetching workflow from source: spec=%s", spec.String())
49
50 // Handle generic HTTP(S) URL imports (non-GitHub hosts).
51 if spec.RawURL != "" {
52 return fetchGenericURLWorkflow(ctx, spec, verbose)
53 }
54
55 // Handle local workflows
56 if isLocalWorkflowPath(spec.WorkflowPath) {
57 return fetchLocalWorkflow(spec, verbose)
58 }
59
60 // Handle remote workflows from GitHub
61 return fetchRemoteWorkflow(ctx, spec, verbose)
62}
63
64// fetchLocalWorkflow reads a workflow file from the local filesystem
65func fetchLocalWorkflow(spec *WorkflowSpec, verbose bool) (*FetchedWorkflow, error) {

Callers 1

Calls 6

fetchGenericURLWorkflowFunction · 0.85
isLocalWorkflowPathFunction · 0.85
fetchLocalWorkflowFunction · 0.85
fetchRemoteWorkflowFunction · 0.85
PrintfMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected