configure_trusted_publisher 0.1.8 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9618ca80722f42567b997bfc7f392a9c2265bf8bfe504a1a6e2b1fcea797d266
4
- data.tar.gz: c64f6c0ec0ddbd143483fc4663826edfafb9c84e6d9a8a82d70c66444ef04347
3
+ metadata.gz: d8825e07f3f9352aeda01d6f45d1806e6d148cad2c7583595126989efcf1a9ba
4
+ data.tar.gz: 86ddce0733c9831c87e5b374ca1d69e3f36751da515cd6ddcaf19d02e6652222
5
5
  SHA512:
6
- metadata.gz: 0a1274ea1f7f908e57801322ecabfe9960d8e6a0a134ae1dd9c3b7238c4f89ec1e0911a86019c4d01e1ff7b99f68f37d2673dcf19dbd702e54b000f4d26b63a8
7
- data.tar.gz: 3e49f2378150f87c043d7807031c84eba9b6bf45f402b486efc7ae45330332df4f3522019740a093e0c90b013d99db68adadd1bc7d4f9e1f47d682e80228a6e6
6
+ metadata.gz: 8ef9d2fb3b4848d8e5241fce485cb1dbe9ef66d6a2d1b8a6479ea7381e97ce4281d0b9db57b3b93a89060229618aac4c6efd9a77ddbd7f5bc3221497dfbafb73
7
+ data.tar.gz: fe25ac3a350ebaf0dffacd5ac734a4aab5a6f2b1f3b80d38727b3dac91612da11b79e6f0e56610836346f131118b5ed4b072f51492b4f7e0991a07a7f39fd67c
@@ -169,7 +169,7 @@ module ConfigureTrustedPublisher
169
169
  },
170
170
  terminate_interaction: lambda { |msg|
171
171
  puts
172
- exit msg
172
+ abort msg
173
173
  },
174
174
  otp: options[:otp]
175
175
  )
@@ -252,12 +252,17 @@ module ConfigureTrustedPublisher
252
252
  return unless ask_yes_or_no("Would you like to add a github environment to allow customizing " \
253
253
  "prerequisites for the action?")
254
254
 
255
+ if Bundler.which("gh").nil?
256
+ abort "The GitHub CLI (gh) is required to add a GitHub environment. " \
257
+ "Please install it from https://cli.github.com/ and try again."
258
+ end
259
+
255
260
  env_name = "rubygems.org"
256
261
 
257
262
  owner, name = github_repository
258
263
  puts "Adding GitHub environment to #{owner}/#{name} to protect the action"
259
264
  if (env = Open3.capture2e("gh", "api", "repos/#{owner}/#{name}/environments").then do |output, status|
260
- exit "Failed to list environments for #{owner}/#{name} using `gh api`:\n#{output}" unless status.success?
265
+ abort "Failed to list environments for #{owner}/#{name} using `gh api`:\n#{output}" unless status.success?
261
266
 
262
267
  JSON.parse(output)["environments"].find { |e| e["name"] == env_name }
263
268
  end)
@@ -268,7 +273,7 @@ module ConfigureTrustedPublisher
268
273
  Open3.capture2e("gh", "api", "--method", "PUT",
269
274
  "repos/#{owner}/#{name}/environments/#{env_name}").then do |output, status|
270
275
  unless status.success?
271
- exit "Failed to create rubygems.org environment for #{owner}/#{name} using `gh api`:\n#{output}"
276
+ abort "Failed to create rubygems.org environment for #{owner}/#{name} using `gh api`:\n#{output}"
272
277
  end
273
278
 
274
279
  env = JSON.parse(output)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConfigureTrustedPublisher
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.10"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configure_trusted_publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Giddins