Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test github-token to see if it is valid before using it #850

Closed
NobodyXu opened this issue Mar 2, 2023 · 2 comments · Fixed by #1121
Closed

Test github-token to see if it is valid before using it #850

NobodyXu opened this issue Mar 2, 2023 · 2 comments · Fixed by #1121

Comments

@NobodyXu
Copy link
Member

NobodyXu commented Mar 2, 2023

We can use:

curl --request GET \
       --url "https://api.github.com/octocat" \
       --header "Authorization: Bearer YOUR-TOKEN"

to test the github-token before using it and possibly print a warning and drop it to fallback to unauthorized mode
if the token is invalid.

@NobodyXu NobodyXu changed the title Test github-token to see if it is valid before using i Test github-token to see if it is valid before using it Mar 2, 2023
@passcod
Copy link
Member

passcod commented Mar 2, 2023

We can also test for the gh*_ prefix as an early check.

@NobodyXu
Copy link
Member Author

NobodyXu commented Mar 3, 2023

Aha right, this is the most simple check we can get.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants