Improve the suggested command for creating an issue when an extension doesn't have a binary for your platform#9608
Conversation
timrogers
commented
Sep 12, 2024
timrogers
commented
Sep 12, 2024
jtmcg
reviewed
Sep 12, 2024
Contributor
Author
|
@jtmcg Just a reminder to take a look at this again ✨ |
… 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](https://github.com/cli/cli/blob/78c1d00eccac1b2ae82ac0bfeea3e2292c98056a/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](https://github.com/cli/cli/blob/78c1d00eccac1b2ae82ac0bfeea3e2292c98056a/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 timrogers/gh-extension-without-binary#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 #9600.
jtmcg
reviewed
Sep 18, 2024
Contributor
jtmcg
left a comment
There was a problem hiding this comment.
Looking good! One final tweak to the language then ![]()
Also, apologies for the delay, I just got back from vacation 🏕️
Co-authored-by: Tyler McGoffin <[email protected]>
Contributor
Author
|
@jtmcg No worries ❤️ Thanks for the suggestion, and I've also updated the test now. |
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Oct 16, 2024
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | minor | `v2.57.0` -> `v2.58.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.58.0`](https://github.com/cli/cli/releases/tag/v2.58.0): GitHub CLI 2.58.0 [Compare Source](cli/cli@v2.57.0...v2.58.0) #### What's Changed - Better messaging for `attestation verify` custom issuer mismatch error by [@​bdehamer](https://github.com/bdehamer) in cli/cli#9616 - Enhance gh repo create docs, fix random cmd link by [@​andyfeller](https://github.com/andyfeller) in cli/cli#9630 - Add HasActiveToken method to AuthConfig to refactor auth check for `attestation trusted-root` command by [@​BagToad](https://github.com/BagToad) in cli/cli#9635 - Improve the suggested command for creating an issue when an extension doesn't have a binary for your platform by [@​timrogers](https://github.com/timrogers) in cli/cli#9608 - Disable auth check for `attestation trusted-root` command by [@​bdehamer](https://github.com/bdehamer) in cli/cli#9610 - build(deps): bump github.com/henvic/httpretty from 0.1.3 to 0.1.4 by [@​dependabot](https://github.com/dependabot) in cli/cli#9645 - Fix tenant-awareness for `trusted-root` command by [@​bdehamer](https://github.com/bdehamer) in cli/cli#9638 - Replace "GitHub Enterprise Server" option with "other" in gh auth login prompting by [@​jtmcg](https://github.com/jtmcg) in cli/cli#9642 - build(deps): bump github.com/cpuguy83/go-md2man/v2 from 2.0.4 to 2.0.5 by [@​dependabot](https://github.com/dependabot) in cli/cli#9634 - Add `dnf5` instructions to `docs/install_linux.md` by [@​its-miroma](https://github.com/its-miroma) in cli/cli#9660 - build(deps): bump github.com/theupdateframework/go-tuf/v2 from 2.0.0 to 2.0.1 by [@​dependabot](https://github.com/dependabot) in cli/cli#9688 #### New Contributors - [@​its-miroma](https://github.com/its-miroma) made their first contribution in cli/cli#9660 **Full Changelog**: cli/cli@v2.57.0...v2.58.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When installing an extension, the CLI must to select the correct binary to download for the machine (see the
installBinfunction).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, directing the user to create an issue on the extension's repository:
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.
I have tested the resulting command on macOS and Windows, so I am confident that it has at least reasonable cross-platform support.
Fixes #9600.
Testing instructions and sample output
To test this, try installing my
timrogers/gh-extension-without-binaryextension, which only has an esotericlinux-ppc64binary 😸:You'll get a nice (coloured) output like this:
...which produces an issue like
timrogers/gh-extension-without-binary#4.