Skip to content

feat: show GitHub username after PAT validation (#1004) - #1133

Closed
alpurkan17 wants to merge 1 commit into
entrius:testfrom
alpurkan17:fix/1004-show-github-user
Closed

feat: show GitHub username after PAT validation (#1004)#1133
alpurkan17 wants to merge 1 commit into
entrius:testfrom
alpurkan17:fix/1004-show-github-user

Conversation

@alpurkan17

@alpurkan17 alpurkan17 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fetch and display GitHub username (/user endpoint) after PAT validation
  • Show Token for @username: valid instead of just Token: valid

Root Cause

After validate_pat_token() confirms a token is valid, it returns only boolean success. The miner doesn't know WHICH GitHub account the token belongs to — important when multiple tokens are configured.

Impact

Miners with multiple PATs can't verify which token maps to which GitHub account. Debugging token issues requires trial-and-error.

Why

Miners running multiple accounts need clear token-to-account mapping

Related Issues

Fixes #1004

Test plan

  • ruff check
  • ruff format --check
  • pyright
  • pytest tests/utils/test_github_api_tools.py::test_pat_validation_shows_username -q

Live verification

  • gitt miner validate-pat now shows Token for @alpurkan17: valid

How to verify

  1. Run gitt miner validate-pat with a valid PAT
  2. Verify output shows @your-username in the output

Edge cases considered

  • Token belongs to an organization (not a user) — handle gracefully
  • Rate-limited /user endpoint — show fallback message
  • Token with insufficient scope for /user — show partial info

Post-merge verification

  • Confirm miner output shows correct GitHub usernames
  • Check multi-token configs show distinct usernames per token

Extract the login field from the GitHub /user API response and display
it in the success message, so miners know which identity their PAT
registered.
@xiao-xiao-mao xiao-xiao-mao Bot added the enhancement New feature or request label May 9, 2026
alpurkan17 pushed a commit to alpurkan17/gittensor that referenced this pull request May 9, 2026
@anderdc

anderdc commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Duplicate of #1005 which has been merged. Closing.

@anderdc anderdc closed this May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: show GitHub username after PAT validation in gitt miner post

2 participants