(ctx context.Context, workflowSpec *WorkflowSpec, sourceInfo *FetchedWorkflow, sourceContent []byte, githubWorkflowsDir string, tracker *FileTracker, opts AddOptions)
| 459 | } |
| 460 | |
| 461 | func fetchWorkflowDependencies(ctx context.Context, workflowSpec *WorkflowSpec, sourceInfo *FetchedWorkflow, sourceContent []byte, githubWorkflowsDir string, tracker *FileTracker, opts AddOptions) error { |
| 462 | // For remote workflows, fetch and save all dependencies (includes, imports, dispatch workflows, resources) |
| 463 | if workflowSpec.RawURL != "" { |
| 464 | // Generic URL imports carry no GitHub repo context; dependency fetching is skipped. |
| 465 | return nil |
| 466 | } |
| 467 | if !isLocalWorkflowPath(workflowSpec.WorkflowPath) { |
| 468 | return fetchAllRemoteDependencies(ctx, string(sourceContent), workflowSpec, githubWorkflowsDir, opts.Verbose, opts.Force, tracker) |
| 469 | } |
| 470 | if sourceInfo == nil || !sourceInfo.IsLocal { |
| 471 | return nil |
| 472 | } |
| 473 | |
| 474 | // For local workflows, collect and copy include dependencies from local paths |
| 475 | // The source directory is derived from the workflow's path |
| 476 | sourceDir := filepath.Dir(workflowSpec.WorkflowPath) |
| 477 | includeDeps, err := collectLocalIncludeDependencies(string(sourceContent), sourceDir, opts.Verbose) |
| 478 | if err != nil { |
| 479 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to collect include dependencies: %v", err))) |
| 480 | } |
| 481 | if err := copyIncludeDependenciesFromPackageWithForce(includeDeps, githubWorkflowsDir, opts.Verbose, opts.Force, tracker); err != nil { |
| 482 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to copy include dependencies: %v", err))) |
| 483 | } |
| 484 | return nil |
| 485 | } |
| 486 | |
| 487 | // When the fetch used a fallback path (e.g. .github/workflows/my-workflow.md instead |
| 488 | // of the short-form my-workflow.md), SourcePath holds the actual repo-root-relative |
no test coverage detected