resolve_token

Function resolve_token 

Source
pub fn resolve_token() -> Option<(SecretString, TokenSource)>
Expand description

Resolves a GitHub token using the priority chain with session-level caching.

Caches the resolved token to avoid repeated subprocess calls to gh auth token. The cache is valid for the lifetime of the session (CLI invocation).

Checks sources in order:

  1. GH_TOKEN environment variable
  2. GITHUB_TOKEN environment variable
  3. GitHub CLI (gh auth token)
  4. System keyring (native aptu auth)

Returns the token and its source, or None if no token is found.