Commit graph

3768 commits

Author SHA1 Message Date
bagtoad
95ca152fea Add examples for creating .gitignore files 2024-10-09 22:51:24 -06:00
bagtoad
922a157206 Update help for license view
Updated `Use` to indicate that args can be an SPDX ID or license key.
Improved the examples docs to show the use of both.
2024-10-09 22:34:06 -06:00
bagtoad
9b94bee895 Refactor http error handling 2024-10-09 22:26:03 -06:00
bagtoad
8abed17a00 implement --web flag for license view 2024-10-09 22:21:26 -06:00
bagtoad
a42d3e2f79 Fix license view help doc, add LICENSE.md example 2024-10-09 21:46:41 -06:00
bagtoad
f07f49810a Update help and fix heredoc indentation 2024-10-09 21:41:54 -06:00
bagtoad
282b3293c5 Add SPDX ID to license list output 2024-10-09 21:21:13 -06:00
bagtoad
d6c6c6b40c Fix ExactArgs invocation 2024-10-09 21:15:16 -06:00
bagtoad
f064bda5ea Add Long for license list indicating limitations 2024-10-09 21:10:35 -06:00
bagtoad
4ecb125c7c Update function names
Licenses are no longer referred to as templates. Prefix the new license and gitignore functions with "Repo" as a more descriptive name.
2024-10-09 21:00:43 -06:00
bagtoad
c2a7756c01 Reverse repo/shared package name change 2024-10-09 20:49:29 -06:00
Kynan Ware
8a1e6ac9f0
Apply suggestions from code review
Co-authored-by: Andy Feller <andyfeller@github.com>
2024-10-08 14:00:30 -06:00
Kynan Ware
04ed1ed1a0
Merge branch 'trunk' into bagtoad/cli-8946-list-licenses-and-gitignore-options 2024-10-06 14:01:58 -06:00
bagtoad
3be44fb6e2 Move API calls to queries_repo.go 2024-10-06 11:51:16 -06:00
Tyler McGoffin
9bd75d23ee
Merge pull request #9650 from timrogers/timrogers/log-platform-fallback
Emit a log message when extension installation falls back to a `darwin-amd64` binary on an Apple Silicon macOS device
2024-10-03 10:19:14 -07:00
bagtoad
0bc0f8c8eb Implement license view 2024-09-29 19:09:46 -06:00
bagtoad
c76acb6aff Implement gitignore view 2024-09-29 17:26:04 -06:00
bagtoad
038b57c866 implement gitignore list 2024-09-29 12:29:56 -06:00
bagtoad
25cdce2cec Update license table headings and tests 2024-09-29 11:59:15 -06:00
bagtoad
2b4464a3af Fix ListLicenseTemplates doc 2024-09-29 11:49:09 -06:00
bagtoad
ac779ba82a fix output capitalization 2024-09-29 11:48:48 -06:00
bagtoad
2f608e3772 Cleanup rendering and tests 2024-09-29 11:46:37 -06:00
bagtoad
1aa2a824ba Remove json output option
Because the API query uses REST, the JSON exporter doesn't work as expected.
2024-09-29 11:00:29 -06:00
bagtoad
21f0d9466e Divide shared repo package and add queries tests 2024-09-29 10:40:22 -06:00
bagtoad
fd8c4633e3 First pass at implementing gh repo license list 2024-09-23 12:30:02 -06:00
Tyler McGoffin
9f3f91f80a
Merge pull request #9642 from cli/jtmcg/503
Replace "GitHub Enterprise Server" option with "other" in gh auth login prompting
2024-09-23 10:50:36 -07:00
Tyler McGoffin
f4af65d9df Update docs language to remove possible confusion around 'where you log in' 2024-09-23 09:35:57 -07:00
Tyler McGoffin
029dc8ffc1 Change conditional in promptForHostname to better reflect prompter changes
The old isEnterprise check no longer makes sense, given the prompter is
providing 'other', not 'GitHub Enterprise Server' as its non-GitHub.com
option. Additionally, there was an opportunity for cleaning up the code
via early returns and the removal of the default hostname lookup if we
don't need it.
2024-09-23 09:04:03 -07:00
Tim Rogers
1eda1b41a7
Emit a log message when extension installation falls back to a darwin-amd64 binary on an Apple Silicon macOS machine 2024-09-21 14:56:43 -05:00
Tyler McGoffin
ccb830ca36 Shorten language on Authenticate with a GitHub host.
The default authentication mode is a web-based browser flow. After completion, an
authentication token will be stored securely in the system credential store.
If a credential store is not found or there is an issue using it gh will fallback
to writing the token to a plain text file. See `gh auth status` for its
stored location.

Alternatively, use `--with-token` to pass in a token on standard input.
The minimum required scopes for the token are: `repo`, `read:org`, and `gist`.

Alternatively, gh will use the authentication token found in environment variables.
This method is most suitable for "headless" use of gh such as in automation. See
`gh help environment` for more info.

To use gh in GitHub Actions, add `GH_TOKEN: ${{ github.token }}` to `env`.

The git protocol to use for git operations on this host can be set with `--git-protocol`,
or during the interactive prompting. Although login is for a single account on a host, setting
the git protocol will take effect for all users on the host.

Specifying `ssh` for the git protocol will detect existing SSH keys to upload,
prompting to create and upload a new key if one is not found. This can be skipped with
`--skip-ssh-key` flag.

USAGE
  gh auth login [flags]

FLAGS
  -p, --git-protocol string   The protocol to use for git operations on this host: {ssh|https}
  -h, --hostname string       The hostname of the GitHub instance to authenticate with
      --insecure-storage      Save authentication credentials in plain text instead of credential store
  -s, --scopes strings        Additional authentication scopes to request
      --skip-ssh-key          Skip generate/upload SSH key prompt
  -w, --web                   Open a browser to authenticate
      --with-token            Read token from standard input

INHERITED FLAGS
  --help   Show help for command

EXAMPLES
  # Start interactive setup
  $ gh auth login

  # Authenticate against github.com by reading the token from a file
  $ gh auth login --with-token < mytoken.txt

  # Authenticate with specific host
  $ gh auth login --hostname enterprise.internal

LEARN MORE
  Use `gh <command> <subcommand> --help` for more information about a command.
  Read the manual at https://cli.github.com/manual
  Learn about exit codes using `gh help exit-codes` around Tylers-GitHub-MacBook.local
2024-09-20 15:51:07 -07:00
Tyler McGoffin
2059c630a2 Update language on docstring for gh auth login 2024-09-20 14:12:13 -07:00
Tyler McGoffin
13e916bcfb Change prompts for gh auth login to reflect change from GHE to Other 2024-09-20 14:10:05 -07:00
Tyler McGoffin
bc587f6576 Sentence case 'Other' option in hostname prompt 2024-09-20 13:55:20 -07:00
Brian DeHamer
5f60b3ca3e
Merge branch 'trunk' into bdehamer/att-trusted-root-tenant-aware 2024-09-20 09:22:40 -07:00
Tyler McGoffin
46790977bb Add documentation explaining how to use hostname for gh auth login 2024-09-19 15:25:23 -07:00
Tyler McGoffin
5dd5246307 Replace "GitHub Enterprise Server" with "other" in gh auth login prompt
This change is meant to better support the login flow for other customers
besides GitHub Enterprise Server customers that use the same login flow
as GHES.
2024-09-19 15:25:23 -07:00
Brian DeHamer
d451a4341b
Merge pull request #9610 from cli/bdehamer/disable-attestation-trusted-root-auth-check
Disable auth check for `attestation trusted-root` command
2024-09-19 12:28:25 -07:00
Tyler McGoffin
65a7e8c4f7
Merge pull request #9608 from timrogers/timrogers/extension-binary-command
Improve the suggested command for creating an issue when an extension doesn't have a binary for your platform
2024-09-19 09:11:49 -07:00
Brian DeHamer
337b284820
Merge branch 'trunk' into bdehamer/disable-attestation-trusted-root-auth-check 2024-09-19 07:07:26 -07:00
Brian DeHamer
8123de9722
fix tenant-awareness for trusted-root command
Signed-off-by: Brian DeHamer <bdehamer@github.com>
2024-09-18 14:05:04 -07:00
Andy Feller
71b2aeab75
Merge pull request #9630 from cli/andyfeller/8946-repo-create-license-gitignore-docs
Enhance gh repo create docs, fix random cmd link
2024-09-18 14:47:06 -04:00
Tim Rogers
665e41566f
Fix test 2024-09-18 19:07:32 +01:00
Tim Rogers
195188cee8
Update pkg/cmd/extension/manager.go
Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2024-09-18 18:55:20 +01:00
bagtoad
d8e77d256f Use new HasActiveToken method in trustedroot.go 2024-09-18 10:35:11 -06:00
Tim Rogers
81d57a0643 Improve error presentation 2024-09-18 14:00:36 +01:00
Tim Rogers
dded039125 Improve the suggested command for creating an issue when an extension doesn't have a binary for your platform
When installing an extension, the CLI must to select the correct
binary to download for the machine (see the
[`installBin` function](78c1d00ecc/pkg/cmd/extension/manager.go (L240))).

By default, the CLI will download a binary matching the current
machine's architecture.

If a suitable binary isn't available, the CLI
[outputs an error](78c1d00ecc/pkg/cmd/extension/manager.go (L278)),
directing the user to create an issue on the extension's
repository:

```go
if asset == nil {
	return fmt.Errorf(
		"%[1]s unsupported for %[2]s. Open an issue: `gh issue create -R %[3]s/%[1]s -t'Support %[2]s'`",
		repo.RepoName(), platform, repo.RepoOwner())
}
```

The issue this creates isn't very clear or helpful. It isn't
obvious where it is coming from, or what you need to do.

This improves the suggested command, adding a better title
to the issue and an explanatory body.

To test this, try installing my
`timrogers/gh-extension-without-binary` extension, which only has
an esoteric `linux-ppc64` binary 😸:

```bash
gh extension install timrogers/gh-extension-without-binary
```

You'll get a nice output like this:

```
gh-extension-without-binary unsupported for darwin-arm64. Open an issue: `gh issue create -R timrogers/gh-extension-without-binary --title "Add support for the darwin-arm64 architecture" --body "This extension does not support the darwin-arm64 architecture. I tried to install it on a darwin-arm64 machine, and it failed due to the lack of an available binary. Would you be able to update the extension's build and release process to include the relevant binary? For more details, see <https://docs.github.com/en/github-cli/github-cli/creating-github-cli-extensions>."`
```

...which produces an issue like
https://github.com/timrogers/gh-extension-without-binary/issues/4.

I have tested the resulting command on macOS and Windows, so
I am confident that it has *at least reasonable* cross-platform
support.

Fixes https://github.com/cli/cli/issues/9600.
2024-09-18 14:00:36 +01:00
Brian DeHamer
3bcedfe7f0
Update pkg/cmd/attestation/trustedroot/trustedroot_test.go
Co-authored-by: Fredrik Skogman <kommendorkapten@github.com>
2024-09-17 14:18:00 -07:00
Brian DeHamer
cbe8525321
enforce auth for tenancy
Signed-off-by: Brian DeHamer <bdehamer@github.com>
2024-09-16 13:52:57 -07:00
Brian DeHamer
8e8fc696f1
disable auth check for att trusted-root cmd
Signed-off-by: Brian DeHamer <bdehamer@github.com>
2024-09-16 12:55:18 -07:00
Brian DeHamer
2e13ec5d80
Merge pull request #9616 from cli/bdehamer/custom-issuer-error
Better messaging for `attestation verify` custom issuer mismatch error
2024-09-16 12:52:12 -07:00