MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / resolveGitHubAuth

Function resolveGitHubAuth

internal/cli/management.go:670–686  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

668//
669// Returns empty string if no token is found.
670func 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
688func matchesQuery(e entities.Entity, query string) bool {
689 if strings.Contains(strings.ToLower(e.Name), query) {

Callers 2

searchGitHubFunction · 0.70
searchGitHubMCPFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected