fix: add graceful error handling when gh CLI is missing or not authenticated#403
Open
stuartmhannon wants to merge 2 commits into
Open
Conversation
…ices#371) Extend SECTIONS to cover all Flipper One repositories listed on the flipperdevices GitHub org page: - Linux (CPU Software): add flipper-linux-kernel, u-boot, rkbin, rockchip-linux, and bsb-protobuf alongside the existing flipperone-linux-build-scripts. These repos are part of the Linux build ecosystem (kernel, bootloader, firmware blobs, protobuf definitions). - FlipCTL: add a new section covering flipctl and flipctl-fonts, as requested in the issue. To support multiple repos per section, change the slug field from str to a list of strings and add a _match_section_slug helper. Also bump --limit from 200 to 1000 to future-proof against growth in the number of help-wanted issues across the org. Tested: script runs successfully with --input-json against a live snapshot of 18 open help-wanted issues. The flipper-linux-kernel issue flipperdevices#6 now correctly appears under the Linux section where it was previously silently dropped.
…ticated
Add two layers of protection in fetch_issues():
1. Early shutil.which('gh') check before attempting the subprocess call
2. try/except around subprocess.run(check=True) catching CalledProcessError
Both paths print a clear, actionable message telling the user to
install gh via brew and authenticate with gh auth login, then exit.
Fixes the opaque CalledProcessError crash identified in task 158.
Collaborator
|
@stuartmhannon, this PR's branch has changes from #402, so I think we'll review and merge that one first. |
NickVolynkin
reviewed
Jul 9, 2026
Comment on lines
+185
to
+191
| except subprocess.CalledProcessError: | ||
| print( | ||
| "Error: gh CLI command failed. Ensure gh is installed (`brew install gh`) " | ||
| "and authenticated (`gh auth login`).", | ||
| file=sys.stderr, | ||
| ) | ||
| sys.exit(1) |
Collaborator
There was a problem hiding this comment.
Let's show the actual gh error output too. It will be useful.
We've checked that gh is installed in a previous step, so it can't be missing here. What could be the problem instead:
- not authenticated: quite likely to happen on a dev's machine; CI runners have
ghpreinstalled. - authenticated, but the user has no read access -- that can only happen if we add a private repo in the list. So, very unlikely to happen.
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.
Wraps the
subprocess.runcall infetch_issues()with a try/exceptCalledProcessErrorso the script exits with a user-friendly message ("install gh and authenticate") instead of a raw Python traceback when theghCLI is not installed or not authenticated.Includes the existing
shutil.which('gh')guard as an early-exit for the missing-binary case.