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)
| 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). |
| 47 | func 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 |
| 65 | func fetchLocalWorkflow(spec *WorkflowSpec, verbose bool) (*FetchedWorkflow, error) { |
no test coverage detected