Retrieves a GitHub authentication token, checking sources in priority order.
Checks GITHUB_TOKEN environment variable first, then falls back to gh auth token
from the GitHub CLI. The result is cached after the first successful lookup (or first
failed attempt), so subsequent calls are instant and do not spawn subprocesses.
Returns string|null
The GitHub token string, or null if no token is available
Example
consttoken = getGitHubToken(); if (token) { // use token for API calls }
Retrieves a GitHub authentication token, checking sources in priority order.
Checks
GITHUB_TOKENenvironment variable first, then falls back togh auth tokenfrom the GitHub CLI. The result is cached after the first successful lookup (or first failed attempt), so subsequent calls are instant and do not spawn subprocesses.