From 6ca7a5872e94d8d0b5d51a9c394e9045fc8b760d Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Fri, 14 Jun 2024 15:09:00 +0200 Subject: [PATCH] Add helpful error when gh is missing --- lib/configure_trusted_publisher/cli.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/configure_trusted_publisher/cli.rb b/lib/configure_trusted_publisher/cli.rb index 6f2d623..b1682e6 100644 --- a/lib/configure_trusted_publisher/cli.rb +++ b/lib/configure_trusted_publisher/cli.rb @@ -252,6 +252,11 @@ def add_environment return unless ask_yes_or_no("Would you like to add a github environment to allow customizing " \ "prerequisites for the action?") + if Bundler.which("gh").nil? + exit "The GitHub CLI (gh) is required to add a GitHub environment. " \ + "Please install it from https://cli.github.com/ and try again." + end + env_name = "rubygems.org" owner, name = github_repository