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)
| 292 | // confirmChanges asks the user to confirm the changes |
| 293 | // secretValue is empty if the secret already exists in the repository |
| 294 | func (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 |
| 324 | func (c *AddInteractiveConfig) showFinalInstructions() { |
no test coverage detected