in cmd/setupgh.go [283:319]
func PromptGitHubRepoWithOwner(gh providers.GhClient) (string, error) {
defaultRepoNameWithOwner, err := gh.GetRepoNameWithOwner()
if err != nil {
return "", err
}
log.Println("Prompting for github repo with owner name...")
repoPrompt := promptui.Prompt{
Label: "Enter github organization and repo organization and repoName",
Validate: func(input string) error {
if !strings.Contains(input, "/") {
return errors.New("github repo cannot be empty")
}
return nil
},
Default: defaultRepoNameWithOwner,
}
repo, err := repoPrompt.Run()
if err != nil {
return "", fmt.Errorf("running repo name with owner prompt: %w", err)
}
log.Debug("Validating github repo...")
if err := gh.IsValidGhRepo(repo); err != nil {
confirmMissingRepoPrompt := promptui.Prompt{
Label: "Unable to confirm this repo exists. Do you want to proceed anyway?",
IsConfirm: true,
}
_, err := confirmMissingRepoPrompt.Run()
if err != nil {
return PromptGitHubRepoWithOwner(gh)
}
} else {
log.Debugf("Github repo %q is valid", repo)
}
return repo, nil
}