(opts AddOptions)
| 440 | } |
| 441 | |
| 442 | func resolveWorkflowTargetDir(opts AddOptions) (gitRoot, githubWorkflowsDir string, err error) { |
| 443 | gitRoot, err = gitutil.FindGitRoot() |
| 444 | if err != nil { |
| 445 | return "", "", fmt.Errorf("add workflow requires being in a git repository: %w", err) |
| 446 | } |
| 447 | if opts.WorkflowDir != "" { |
| 448 | if filepath.IsAbs(opts.WorkflowDir) { |
| 449 | return "", "", fmt.Errorf("workflow directory must be a relative path, got: %s", opts.WorkflowDir) |
| 450 | } |
| 451 | githubWorkflowsDir = filepath.Join(gitRoot, filepath.Clean(opts.WorkflowDir)) |
| 452 | } else { |
| 453 | githubWorkflowsDir = filepath.Join(gitRoot, constants.GetWorkflowDir()) |
| 454 | } |
| 455 | if err := os.MkdirAll(githubWorkflowsDir, constants.DirPermPublic); err != nil { |
| 456 | return "", "", fmt.Errorf("failed to create workflow directory %s: %w", githubWorkflowsDir, err) |
| 457 | } |
| 458 | return gitRoot, githubWorkflowsDir, nil |
| 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) |
no test coverage detected