checkGHAuthStatusShared verifies the user is logged in to GitHub CLI
(verbose bool)
| 16 | |
| 17 | // checkGHAuthStatusShared verifies the user is logged in to GitHub CLI |
| 18 | func checkGHAuthStatusShared(verbose bool) error { |
| 19 | preconditionsLog.Print("Checking GitHub CLI authentication status") |
| 20 | |
| 21 | output, err := workflow.RunGHCombined("Checking GitHub authentication...", "auth", "status") |
| 22 | |
| 23 | if err != nil { |
| 24 | fmt.Fprintln(os.Stderr, console.FormatErrorMessage("You are not logged in to GitHub CLI.")) |
| 25 | fmt.Fprintln(os.Stderr, "") |
| 26 | fmt.Fprintln(os.Stderr, "Please run the following command to authenticate:") |
| 27 | fmt.Fprintln(os.Stderr, "") |
| 28 | fmt.Fprintln(os.Stderr, console.FormatCommandMessage(" gh auth login")) |
| 29 | fmt.Fprintln(os.Stderr, "") |
| 30 | return errors.New("not authenticated with GitHub CLI") |
| 31 | } |
| 32 | |
| 33 | if verbose { |
| 34 | fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("GitHub CLI authenticated")) |
| 35 | preconditionsLog.Printf("gh auth status output: %s", string(output)) |
| 36 | } |
| 37 | |
| 38 | return nil |
| 39 | } |
| 40 | |
| 41 | // checkActionsEnabledShared verifies that GitHub Actions is enabled for the repository |
| 42 | // and that the allowed actions settings permit running agentic workflows |
no test coverage detected