feat(env): register GITHUB_TOKEN for .env and keychain end-to-end support#793
Open
23241a6749 wants to merge 2 commits into
Open
feat(env): register GITHUB_TOKEN for .env and keychain end-to-end support#79323241a6749 wants to merge 2 commits into
23241a6749 wants to merge 2 commits into
Conversation
…port GITHUB_TOKEN was missing from env.py's CONFIGURATION_KEYS and KEYCHAIN_KEYS, so .env and keychain-stored tokens were silently ignored. Pipeline.py already passes config.get(GITHUB_TOKEN) to github._resolve_token, so registration alone completes the end-to-end. Closes mvanhorn#792 References mvanhorn#724 (closed), mvanhorn#782 (merged)
Contributor
…N shows in doctor
_github_record now checks config.get("GITHUB_TOKEN") first (covering
.env and keychain sources), falling back to os.environ (for process-env-only
cases), before trying gh CLI. This mirrors _resolve_token's same two-source
pattern and ensures doctor's auth display matches real token availability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GITHUB_TOKENis missing fromenv.py's keys tuple andKEYCHAIN_KEYS. Users who setGITHUB_TOKENin their.envfile find it silently ignored —config.get("GITHUB_TOKEN")always returnsNonebecause unregistered keys are never loaded from.envinto the config dict.This was partially addressed by:
doctor.pyto readGITHUB_TOKENfrom the environment directlyThe maintainer's feedback on PR #724:
Changes
env.py: Added"GITHUB_TOKEN"to both:KEYCHAIN_KEYStuple — enables macOS Keychain /pass(1)store supportget_configkeys tuple — so.envvalues are loaded intoconfigsetup-keychain.sh: AddedGITHUB_TOKENtoALL_KEYSarraysetup-pass.sh: AddedGITHUB_TOKENtoALL_KEYSarrayWhy this is sufficient
lib/github.py's_resolve_tokenalready checks thetokenargument first before falling back toos.environandgh auth token.pipeline.pyalready passesconfig.get("GITHUB_TOKEN")as that argument. Once the key is registered,config.get("GITHUB_TOKEN")returns the.envvalue, and it flows through to the GitHub API client end-to-end.Both
doctor.pyandpipeline.pyalso useconfig.get("GITHUB_TOKEN")for thehas_githubcheck — they'll now accurately reflect.env-configured tokens.Verification
All 77 tests pass across keychain, pass, env-doc-contract, doctor, and no-bare-open-read test suites.