Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cli/repo_error_messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestRepoSlugErrorMessages(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Test ensureTrialRepository function
err := ensureTrialRepository(tt.repoSlug, "", false, false)
err := ensureTrialRepository(tt.repoSlug, "", false, false, false)

if err == nil {
t.Errorf("expected error for repo slug '%s', got nil", tt.repoSlug)
Expand Down
17 changes: 16 additions & 1 deletion pkg/cli/trial_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type TrialOptions struct {
DeleteHostRepo bool
ForceDelete bool
Quiet bool
DryRun bool
TimeoutMinutes int
TriggerContext string
RepeatCount int
Expand Down Expand Up @@ -94,6 +95,7 @@ Repeat and cleanup examples:
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --repeat 3 # Run 3 times total
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --delete-host-repo-after # Delete repo after completion
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --quiet --host-repo my-trial # Custom host repo
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --dry-run # Show what would be done without changes

Auto-merge examples:
` + string(constants.CLIExtensionPrefix) + ` trial githubnext/agentics/my-workflow --auto-merge-prs # Auto-merge any PRs created during trial
Expand Down Expand Up @@ -121,6 +123,7 @@ Trial results are saved both locally (in trials/ directory) and in the host repo
deleteHostRepo, _ := cmd.Flags().GetBool("delete-host-repo-after")
forceDeleteHostRepo, _ := cmd.Flags().GetBool("force-delete-host-repo-before")
yes, _ := cmd.Flags().GetBool("yes")
dryRun, _ := cmd.Flags().GetBool("dry-run")
timeout, _ := cmd.Flags().GetInt("timeout")
triggerContext, _ := cmd.Flags().GetString("trigger-context")
repeatCount, _ := cmd.Flags().GetInt("repeat")
Expand All @@ -147,6 +150,7 @@ Trial results are saved both locally (in trials/ directory) and in the host repo
DeleteHostRepo: deleteHostRepo,
ForceDelete: forceDeleteHostRepo,
Quiet: yes,
DryRun: dryRun,
TimeoutMinutes: timeout,
TriggerContext: triggerContext,
RepeatCount: repeatCount,
Expand Down Expand Up @@ -180,6 +184,7 @@ Trial results are saved both locally (in trials/ directory) and in the host repo
cmd.Flags().Bool("delete-host-repo-after", false, "Delete the host repository after completion (default: keep)")
cmd.Flags().Bool("force-delete-host-repo-before", false, "Force delete the host repository before creation, if it exists before creating it")
cmd.Flags().BoolP("yes", "y", false, "Skip confirmation prompts")
cmd.Flags().Bool("dry-run", false, "Show what would be done without making any changes")
cmd.Flags().Int("timeout", 30, "Execution timeout in minutes (default: 30)")
cmd.Flags().String("trigger-context", "", "Trigger context URL (e.g., GitHub issue URL) for issue-triggered workflows")
cmd.Flags().Int("repeat", 0, "Number of times to repeat running workflows (0 = run once)")
Expand Down Expand Up @@ -207,6 +212,10 @@ func RunWorkflowTrials(ctx context.Context, workflowSpecs []string, opts TrialOp
parsedSpecs = append(parsedSpecs, parsedSpec)
}

if opts.DryRun {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("[DRY RUN] Showing what would be done without making changes"))
}

if len(parsedSpecs) == 1 {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Starting trial of workflow '%s' from '%s'", parsedSpecs[0].WorkflowName, parsedSpecs[0].RepoSlug)))
} else {
Expand Down Expand Up @@ -303,10 +312,16 @@ func RunWorkflowTrials(ctx context.Context, workflowSpecs []string, opts TrialOp

// Step 2: Create or reuse host repository
trialLog.Printf("Ensuring trial repository exists: %s", hostRepoSlug)
if err := ensureTrialRepository(hostRepoSlug, cloneRepoSlug, opts.ForceDelete, opts.Verbose); err != nil {
if err := ensureTrialRepository(hostRepoSlug, cloneRepoSlug, opts.ForceDelete, opts.DryRun, opts.Verbose); err != nil {
return fmt.Errorf("failed to ensure host repository: %w", err)
}

// In dry-run mode, stop here after showing what would be done
if opts.DryRun {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("[DRY RUN] Stopping here. No actual changes were made."))
return nil
}
Comment on lines +319 to +323
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new dry-run functionality lacks test coverage. Given that the codebase has comprehensive test coverage for similar flag-based functionality (as seen in the test files), consider adding unit tests to verify:

  1. The dry-run flag is correctly parsed and stored in TrialOptions
  2. The ensureTrialRepository function behaves correctly in dry-run mode (doesn't make actual API calls that modify state)
  3. The early exit logic at line 319-322 is triggered correctly in dry-run mode
  4. Dry-run messages are formatted consistently

This would help ensure the feature works as expected and prevent regressions.

Copilot uses AI. Check for mistakes.

// Step 2.5: Create secret tracker
var secretTracker *TrialSecretTracker
if opts.PushSecrets {
Expand Down
Loading
Loading