src-d / ghsync

GitHub API v3 > PostgreSQL
https://sourced.tech
GNU General Public License v3.0
9 stars 8 forks source link

Add validate sub command #46

Open smacker opened 5 years ago

smacker commented 5 years ago

Accepts the same arguments as shallow command for a token and list of organizations.

To validate the token makes request to /me endpoint that doesn't require any special permissions.

To validate organizations makes requests to /orgs/<name>.

Returns human friendly errors in 2 most common cases:

For any other errors it returns go-github error as is.

Example output:

$ ghsync validate --token=not-valid --orgs=src-d,thisorgshouldnotexistforsurebecauseisaidso
github token is not valid
exit status 1
$ ghsync validate --token=<valid> --orgs=src-d,thisorgshouldnotexistforsurebecauseisaidso
organization 'thisorgshouldnotexistforsurebecauseisaidso' is not found
exit status 1
$ ghsync validate --token=<valid> --orgs=src-d
$ echo $?
0

Ref: https://github.com/src-d/sourced-ce/issues/59

smacker commented 5 years ago

No need right now. Move to to-do to come back to it after release.