| 223 | } |
| 224 | |
| 225 | func authHelp() string { |
| 226 | if os.Getenv("GITHUB_ACTIONS") == "true" { |
| 227 | return heredoc.Doc(` |
| 228 | gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example: |
| 229 | env: |
| 230 | GH_TOKEN: ${{ github.token }} |
| 231 | `) |
| 232 | } |
| 233 | |
| 234 | if os.Getenv("CI") != "" { |
| 235 | return heredoc.Doc(` |
| 236 | gh: To use GitHub CLI in automation, set the GH_TOKEN environment variable. |
| 237 | `) |
| 238 | } |
| 239 | |
| 240 | return heredoc.Doc(` |
| 241 | To get started with GitHub CLI, please run: gh auth login |
| 242 | Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token. |
| 243 | `) |
| 244 | } |
| 245 | |
| 246 | func findCommand(cmd *cobra.Command, name string) *cobra.Command { |
| 247 | for _, c := range cmd.Commands() { |