This will check if `gh` is running in a CI environment. If so, it will
suggest using environment variables to set the auth token. Additionally,
if the CI environment is detected to be GitHub Actions, it will provide
some example code. If it is not a CI environment, it will print the
standard help message.
Co-authored-by: Mislav Marohnić <mislav@github.com>
We can strip the "v" prefix where it's unambiguous that we're talking
about version numbers.
Before:
A new release of gh is available: 2.8.0 => v2.9.0
After:
A new release of gh is available: 2.8.0 => 2.9.0
The GH_DEBUG environment variable is a new gh-specific verbosity control.
For backwards-compatibility, DEBUG will still be respected if it has values
"1", "true", "yes", and "api", but any other values will be ignored.
Finally, support for "oauth" debug value has been dropped in favor of "api".
The "oauth" value only had limited, internal use.
Co-authored-by: Mislav Marohnić <mislav@github.com>
While a gh command is writing stdout to a pager, the user may choose to
close the pager program before the pager has read all the data on its
standard input. In that case, the parent gh process will receive an
EPIPE error, which would bubble up its error handling and cause it to
print something like:
write |1: broken pipe
Since this was caused by an explicit user action of closing the pager,
and since the user probably doesn't want to see this uninformative
error, this informs our global error handling of this error and causes
it to be ignored.
Whenever a SSO challenge gets issued by the server by means of a URL in
the `X-GitHub-SSO` response header, gh now additionally prints that URL
on the standard error stream.
This is achieved by installing a middleware to all HTTP requests and
storing the server challenge to a value accessible by `factory.SSOURL()`.
Such approach was made necessary mainly because of the
`shurcool-graphql` client which doesn't give access to response headers
when a GraphQL error case is encountered.
- Fix name of man pages for all but the toplevel command
- Set title of all man pages to "GitHub CLI manual"
- Include gh version information in man pages
- Clean up rendering of flags section
- List subcommands for every command
If a 4xx server response lists scopes in the X-Accepted-Oauth-Scopes
header that are not present in the X-Oauth-Scopes header, the final
error messaging on stderr will now include a hint for the user that they
might need to request the additional scope:
$ gh codespace list
error getting codespaces: HTTP 403: Must have admin rights to Repository. (https://api.github.com/user/codespaces?per_page=30)
This API operation needs the "codespace" scope. To request it, run: gh auth refresh -h github.com -s codespace
The `github.com/shirou/gopsutil` dependency of lightstep-tracer is
giving us trouble during building.
Ref. https://github.com/shirou/gopsutil/issues/976
Another build problem raises its head even after we upgrade gopsutil to
a version where the above bug is fixed.
The API layer shouldn't concern itself with logging progress to stderr.
Instead, we will subsequently add progress indicators in the caller
around CreateCodespace and other potentially slow commands as needed.
This is to avoid hitting the filesystem and resolving symlinks
unnecessarily. The value of executable is just used conditionally by a
handful of commands.