MCPcopy Create free account
hub / github.com/github/gh-aw / confirmChanges

Method confirmChanges

pkg/cli/add_interactive_orchestrator.go:294–321  ·  view source on GitHub ↗

confirmChanges asks the user to confirm the changes secretValue is empty if the secret already exists in the repository

(workflowFiles, initFiles []string, secretName string, secretValue string)

Source from the content-addressed store, hash-verified

292// confirmChanges asks the user to confirm the changes
293// secretValue is empty if the secret already exists in the repository
294func (c *AddInteractiveConfig) confirmChanges(workflowFiles, initFiles []string, secretName string, secretValue string) error {
295 addInteractiveLog.Print("Confirming changes with user")
296
297 fmt.Fprintln(os.Stderr, "")
298
299 confirmed := true // Default to yes
300 form := huh.NewForm(
301 huh.NewGroup(
302 huh.NewConfirm().
303 Title("Do you want to proceed with these changes?").
304 Description("A pull request will be created with the workflow files").
305 Affirmative("Yes, create pull request").
306 Negative("No, cancel").
307 Value(&confirmed),
308 ),
309 ).WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode())
310
311 if err := form.RunWithContext(c.Ctx); err != nil {
312 return fmt.Errorf("confirmation failed: %w", err)
313 }
314
315 if !confirmed {
316 fmt.Fprintln(os.Stderr, "Operation cancelled.")
317 return errors.New("user cancelled the operation")
318 }
319
320 return nil
321}
322
323// showFinalInstructions shows final instructions to the user
324func (c *AddInteractiveConfig) showFinalInstructions() {

Callers 1

RunAddInteractiveFunction · 0.80

Calls 3

IsAccessibleModeFunction · 0.92
PrintMethod · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected