Skip to content

fix: add graceful error handling when gh CLI is missing or not authenticated#403

Open
stuartmhannon wants to merge 2 commits into
flipperdevices:public-releasefrom
stuartmhannon:fix/gh-cli-missing-error-handling
Open

fix: add graceful error handling when gh CLI is missing or not authenticated#403
stuartmhannon wants to merge 2 commits into
flipperdevices:public-releasefrom
stuartmhannon:fix/gh-cli-missing-error-handling

Conversation

@stuartmhannon

Copy link
Copy Markdown

Wraps the subprocess.run call in fetch_issues() with a try/except CalledProcessError so the script exits with a user-friendly message ("install gh and authenticate") instead of a raw Python traceback when the gh CLI is not installed or not authenticated.

Includes the existing shutil.which('gh') guard as an early-exit for the missing-binary case.

…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.
@NickVolynkin

Copy link
Copy Markdown
Collaborator

@stuartmhannon, this PR's branch has changes from #402, so I think we'll review and merge that one first.

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 gh preinstalled.
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants