(ctx context.Context, targetRepo string, workflows []string, addOpts AddOptions, coolDown time.Duration)
| 48 | } |
| 49 | |
| 50 | func runDeploy(ctx context.Context, targetRepo string, workflows []string, addOpts AddOptions, coolDown time.Duration) error { |
| 51 | checkoutDir, originalDir, err := prepareDeployCheckout(ctx, targetRepo) |
| 52 | if err != nil { |
| 53 | return err |
| 54 | } |
| 55 | defer func() { |
| 56 | _ = os.Chdir(originalDir) |
| 57 | }() |
| 58 | |
| 59 | resolvedWorkflows := resolveDeployWorkflowSpecs(workflows, originalDir) |
| 60 | |
| 61 | if err := os.Chdir(checkoutDir); err != nil { |
| 62 | return fmt.Errorf("failed to change directory to checkout %s: %w", checkoutDir, err) |
| 63 | } |
| 64 | |
| 65 | if err := runDeployUpdatePass(ctx, addOpts, coolDown); err != nil { |
| 66 | return err |
| 67 | } |
| 68 | |
| 69 | if err := runDeployAddPass(ctx, resolvedWorkflows, addOpts); err != nil { |
| 70 | return err |
| 71 | } |
| 72 | |
| 73 | if err := runDeployCompilePass(ctx, addOpts); err != nil { |
| 74 | return err |
| 75 | } |
| 76 | |
| 77 | if err := createDeployPR(resolvedWorkflows, targetRepo, addOpts.Verbose); err != nil { |
| 78 | return err |
| 79 | } |
| 80 | |
| 81 | deployLog.Printf("Successfully deployed workflows to %s", targetRepo) |
| 82 | return nil |
| 83 | } |
| 84 | |
| 85 | func validateDeployArgs(cmd *cobra.Command, args []string) error { |
| 86 | if len(args) < 1 { |
nothing calls this directly
no test coverage detected