Expand description
Centralized GitHub token resolution — supports env vars, GitHub App JWT, and gh CLI fallback.
This module provides a TokenResolver that caches token resolution and supports multiple modes:
env(default): Read fromGH_TOKENorGITHUB_TOKENenv vars, thengh.auth.tokenconfig, thengh auth tokenCLI (controlled byallow_gh_fallback, which defaults totrue)github_app: Generate JWT from app_id + private_key (for GitHub App authentication)
§Default behavior
Out of the box, TokenResolver::default() works with just gh auth login — no extra config needed.
Resolution order:
GH_TOKENenvironment variableGITHUB_TOKENenvironment variablegh.auth.tokenconfig valuegh auth tokenCLI (viaallow_gh_fallback = true)
Structs§
- Token
Resolver - Centralized token resolver for GitHub authentication.
Enums§
- Token
Mode - Token source mode for GitHub authentication.
Functions§
- create_
token_ resolver - Create a global token resolver from configuration.
- shared
- Get the process-wide shared token resolver.