25 Commits

Author SHA1 Message Date
Issy Long
87348dc179
Apply suggestions from code review
Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-02-07 02:05:46 +01:00
Issy Long
41b143deec
cmd/gist-logs: On 404, the PAT probably needs more permissions
- This 404 error is from GitHub, and GitHub doesn't give us any more
  informations about scopes for the gist endpoint (for some reason). But we can
  safely assume, as it happens a lot, that "Error: Not Found" (404) is because
  the user hasn't granted their `HOMEBREW_GITHUB_API_TOKEN` the `gist` scope.

Before:

```shell
$ HOMEBREW_GITHUB_API_TOKEN=<token_without_gist_scope> brew gist-logs -p logrotate
Error: Not Found
```

After:

```shell
❯ HOMEBREW_GITHUB_API_TOKEN=<token_without_gist_scope> brew gist-logs logrotate
Error: Your GitHub API token likely doesn't have the `gist` scope.
Create a GitHub personal access token:
https://github.com/settings/tokens/new?scopes=gist&description=Homebrew
echo 'export HOMEBREW_GITHUB_API_TOKEN=your_token_here' >> ~/.zshrc
```
2023-02-06 17:00:02 +01:00
Dustin Rodrigues
5e9223d059
add explicit version for GitHub API 2022-12-19 12:00:12 -05:00
Mike McQuaid
4e03afeeb6
utils/github/api: curl format token, not a ruby one. 2022-12-13 11:37:05 +00:00
hyuraku
43eca95ce4 reset require-utils/github location 2022-11-07 23:12:27 +09:00
Mike McQuaid
bc295f7947
update-sponsors: don't require admin token.
Instead, use a different API to query these with a lower scope.

This should be usable by GitHub Actions.
2022-09-07 16:49:41 +01:00
Alexander Bayandin
4e8cc524c5 Clean up GitHub headers 2022-07-24 11:44:16 +00:00
Bo Anderson
3e75b165ae
utils/github: rewrite get_workflow_run using GraphQL 2022-04-11 20:35:03 +01:00
Adrian Ho
f5f4d5b082 github_api: fix recommended PAT URL
Closes #13030.
2022-03-24 10:18:02 +08:00
Logicer
7beb1f227c
Update Library/Homebrew/utils/github/api.rb
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2021-07-20 12:06:04 +10:00
Logicer
ed4f840a67
Fix style 2021-07-20 09:22:34 +10:00
Logicer
0c6f5ab233
Put API.credentials bit into separate variable 2021-07-20 09:18:16 +10:00
Logicer
71b61d28d1 Fix Style 2021-07-19 12:09:23 +10:00
Logicer
06f415e819 Dont ask to create PAT if one already exists 2021-07-19 10:28:11 +10:00
Logicer
5b7921ff68 Add support for GitHub Oauth tokens from keychain 2021-07-18 21:47:11 +10:00
hyuraku
90c02f7b5a change https://api.github.com to API_URL 2021-06-02 21:13:53 +09:00
Mike McQuaid
6f071a06f8
Use JSON.pretty_generate
It's dramatically more human readable for very little difference in
space.
2021-04-09 15:44:37 +01:00
Rylan Polster
95a5c58eee
Merge pull request #10847 from jonchang/github-pat-update
github/api: update personal access token format.
2021-04-05 19:43:43 -04:00
Rylan Polster
229e035a3d
Update PAT regex 2021-04-05 19:23:18 -04:00
Bo Anderson
ec20eb604d
utils/gitub/api: fix incorrect error when unauthenticated 2021-04-02 15:36:14 +01:00
Bo Anderson
450bc4ab33
Fix brew style 2021-03-26 14:11:03 +00:00
Jonathan Chang
cd280ee52a github/api: update personal access token format.
https://github.blog/changelog/2021-03-04-authentication-token-format-updates/
2021-03-14 18:25:38 +11:00
nandahkrishna
7b0352f167
utils/github/api: simplify pagination 2021-03-11 14:50:19 +05:30
nandahkrishna
f7c8810214
utils/github/api: remove 'api' from method names 2021-02-17 23:47:05 +05:30
nandahkrishna
9d8a5827a3
utils/github: split module 2021-02-15 21:08:10 +05:30