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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8825e07f3f9352aeda01d6f45d1806e6d148cad2c7583595126989efcf1a9ba
|
4
|
+
data.tar.gz: 86ddce0733c9831c87e5b374ca1d69e3f36751da515cd6ddcaf19d02e6652222
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
-
|
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)
|