NewDeployCommand creates the deploy command.
(validateEngine func(string) error)
| 25 | |
| 26 | // NewDeployCommand creates the deploy command. |
| 27 | func NewDeployCommand(validateEngine func(string) error) *cobra.Command { |
| 28 | cmd := &cobra.Command{ |
| 29 | Use: "deploy <workflow>...", |
| 30 | Short: "Deploy agentic workflows to a target repository using a pull request", |
| 31 | Long: `Deploy one or more workflows to a target repository by combining clone, update, add, compile, and pull request creation. |
| 32 | |
| 33 | The command clones the target repository, updates existing workflows from source, adds the specified workflows, recompiles lock files with purge enabled, and opens a pull request.`, |
| 34 | Example: ` ` + string(constants.CLIExtensionPrefix) + ` deploy githubnext/agentics/ci-doctor --repo owner/repo |
| 35 | ` + string(constants.CLIExtensionPrefix) + ` deploy githubnext/agentics/repo-assist githubnext/agentics/ci-doctor --repo owner/repo --force |
| 36 | ` + string(constants.CLIExtensionPrefix) + ` deploy ./my-workflow.md --repo owner/repo |
| 37 | ` + string(constants.CLIExtensionPrefix) + ` deploy githubnext/agentics/ci-doctor --org my-org --yes |
| 38 | ` + string(constants.CLIExtensionPrefix) + ` deploy githubnext/agentics/ci-doctor --org my-org --repos '*-service' --yes`, |
| 39 | Args: validateDeployArgs, |
| 40 | RunE: func(cmd *cobra.Command, args []string) error { |
| 41 | return runDeployCommand(cmd, args, validateEngine) |
| 42 | }, |
| 43 | } |
| 44 | |
| 45 | registerDeployFlags(cmd) |
| 46 | |
| 47 | return cmd |
| 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) |