Improve the GitHub API scope and token related messaging by
autopopulating the scopes we need on the new scopes page and, in the
case of a lacking a scope we need, output what scope was required.
Also, DRY up the personal access token code.
* Move GitHub API module to utils/github.rb.
* Move curl method to utils/curl.rb.
* global: use long curl arguments and an array.
This makes the code more self-documenting.
* utils/curl: support reading curl's output.
* utils/github: use curl instead of open-uri.
It has far better proxy support.
* pull: set Homebrew user agent.
* gist-logs: remove trailing whitespace.
* gist-logs: use first instead of [0].
Easier to read.
* gist-logs: use curl-based GitHub.open method.
The API used (`Net::HTTP::Post`) does not handle basic authentication
credentials in the same way as `open` so fix both cases so they work.
Also, do some general usability tweaks to point out to people what could
be wrong with their tokens or credentials to help them debug.
ClosesHomebrew/homebrew#50410.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Adds a summary file and description to get more informative displays on gist.github.com.
ClosesHomebrew/homebrew#45023.
Signed-off-by: Andrew Janke <andrew@apjanke.net>
The link for the page that allows creation of API tokens has changed
from /settings/applications to /settings/tokens. Also the wording
on that page calls them "personal access tokens", so update
Homebrew to be consistent with that.
ClosesHomebrew/homebrew#39378.
Signed-off-by: Tim D. Smith <git@tim-smith.us>