load test
Find a file
Issy Long cb29b11ab2 cmd/ghcs/main: Fail gracefully if GITHUB_TOKEN entirely unset
- I have my GitHub API token in my environment as
  `HOMEBREW_GITHUB_API_TOKEN`, so with things that need `GITHUB_TOKEN` I
  have to remember to `export GITHUB_TOKEN=$HOMEBREW_GITHUB_API_TOKEN`.
- I didn't for this tool, and got this unfriendly error message:

```
❯ ghcs list
Error: error getting user: Bad credentials
Usage:
  ghcs list [flags]

Flags:
  -h, --help   help for list

error getting user: Bad credentials
```

- This moves the "do you have a `GITHUB_TOKEN`" question to the very
  beginning (no guarantees about org SSO access, just a string that
  exists), erroring out with a nice message if users don't have that
  envvar set:

```
issyl0 in cetus in ~/repos/github/ghcs/cmd/ghcs on gracefully-fail-if-token-envvar-unset
❯ ./ghcs list
The GITHUB_TOKEN environment variable is required. Create a Personal Access Token with org SSO access at https://github.com/settings/tokens/new.

issyl0 in cetus in ~/repos/github/ghcs/cmd/ghcs on gracefully-fail-if-token-envvar-unset
❯ export GITHUB_TOKEN=$HOMEBREW_GITHUB_API_TOKEN

❯ ./ghcs list
+--------------------------------+--------------------+------------------------------------+----------+---------------------------+
|              NAME              |     REPOSITORY     |               BRANCH               |  STATE   |        CREATED AT         |
+--------------------------------+--------------------+------------------------------------+----------+---------------------------+
| issyl0-github-cat-ggrpj5fvwvr  | github/cat         | dependabot/bundler/graphql-1.12.13 | Shutdown | 2021-07-13T12:36:53+01:00 |
+--------------------------------+--------------------+------------------------------------+----------+---------------------------+
```
2021-07-19 18:10:15 +01:00
api Portfowarding private/public/forward now supported 2021-07-17 20:32:47 -04:00
cmd/ghcs cmd/ghcs/main: Fail gracefully if GITHUB_TOKEN entirely unset 2021-07-19 18:10:15 +01:00
internal/codespaces Portfowarding private/public/forward now supported 2021-07-17 20:32:47 -04:00