fetchLocalWorkflow reads a workflow file from the local filesystem
(spec *WorkflowSpec, verbose bool)
| 63 | |
| 64 | // fetchLocalWorkflow reads a workflow file from the local filesystem |
| 65 | func 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 |
| 88 | func fetchRemoteWorkflow(ctx context.Context, spec *WorkflowSpec, verbose bool) (*FetchedWorkflow, error) { |