resolveGitHubAuth returns a GitHub API auth header by checking, in order: 1. GITHUB_TOKEN env var 2. GH_TOKEN env var 3. `gh auth token` command output (uses gh CLI's stored credentials) Returns empty string if no token is found.
()
| 668 | // |
| 669 | // Returns empty string if no token is found. |
| 670 | func resolveGitHubAuth() string { |
| 671 | if token := os.Getenv("GITHUB_TOKEN"); token != "" { |
| 672 | return "token " + token |
| 673 | } |
| 674 | if token := os.Getenv("GH_TOKEN"); token != "" { |
| 675 | return "token " + token |
| 676 | } |
| 677 | // Fall back to gh CLI's auth system. |
| 678 | out, err := exec.Command("gh", "auth", "token").Output() |
| 679 | if err == nil { |
| 680 | token := strings.TrimSpace(string(out)) |
| 681 | if token != "" { |
| 682 | return "token " + token |
| 683 | } |
| 684 | } |
| 685 | return "" |
| 686 | } |
| 687 | |
| 688 | func matchesQuery(e entities.Entity, query string) bool { |
| 689 | if strings.Contains(strings.ToLower(e.Name), query) { |
no outgoing calls
no test coverage detected