ci_toolkit 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ci_toolkit/bitrise_client.rb +9 -5
- data/lib/ci_toolkit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ea8b1d9d2121152ff2f48ecb1265130b549f3a88233711b6b741bc7f49e2405
|
4
|
+
data.tar.gz: 8e167d886d553a374a2b1e26a76a6fcd0bda777b295f685d98c944cd7305e704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5241d883ecd2701c0b56e433934093bce2c095800376c0dc9deb0e88f65054b4db84f487a8280ee9a333f5185f79960a224a6052a60dadc6414ef562c569aa05
|
7
|
+
data.tar.gz: 05b5d77bb2699c5c811604e7b99ce96f1dd8506f767b4a77051bc37da6fcb0febe7b8f7568acfb869c05de2364f30c4088b15a0f312cdf4699ef3f12709488bb
|
data/Gemfile.lock
CHANGED
@@ -9,7 +9,11 @@ module CiToolkit
|
|
9
9
|
API_VERSION = "v0.1"
|
10
10
|
attr_reader :connection
|
11
11
|
|
12
|
-
def initialize(
|
12
|
+
def initialize(
|
13
|
+
token = ENV["BITRISE_TOKEN"],
|
14
|
+
app_slug = ENV["BITRISE_APP_SLUG"],
|
15
|
+
faraday = nil
|
16
|
+
)
|
13
17
|
@token = token
|
14
18
|
@app_slug = app_slug
|
15
19
|
@connection = faraday
|
@@ -26,8 +30,8 @@ module CiToolkit
|
|
26
30
|
)
|
27
31
|
@connection.use Faraday::Request::UrlEncoded
|
28
32
|
@connection.use Faraday::Request::Retry
|
29
|
-
@connection.use FaradayMiddleware::ParseJson
|
30
33
|
@connection.use FaradayMiddleware::EncodeJson
|
34
|
+
@connection.use FaradayMiddleware::ParseJson
|
31
35
|
@connection.use FaradayMiddleware::FollowRedirects
|
32
36
|
end
|
33
37
|
|
@@ -46,7 +50,7 @@ module CiToolkit
|
|
46
50
|
|
47
51
|
def abort_pull_request_builds(pull_request, branch, commit)
|
48
52
|
find_pull_request_builds(pull_request, branch, commit).each do |build|
|
49
|
-
@connection&.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build[
|
53
|
+
@connection&.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build["slug"]}/abort", {
|
50
54
|
abort_reason: "Aborting due to other build failed for pull request #{pull_request}"
|
51
55
|
})
|
52
56
|
end
|
@@ -61,14 +65,14 @@ module CiToolkit
|
|
61
65
|
puts "Response:\n"
|
62
66
|
puts response.inspect
|
63
67
|
|
64
|
-
builds = response.body[
|
68
|
+
builds = response.body["data"]
|
65
69
|
filter_builds_by_commit(builds, commit)
|
66
70
|
end
|
67
71
|
|
68
72
|
def filter_builds_by_commit(builds, commit)
|
69
73
|
puts "Builds:\n"
|
70
74
|
puts builds.inspect
|
71
|
-
builds&.select! { |build| build[
|
75
|
+
builds&.select! { |build| build["commit_hash"] == commit }
|
72
76
|
builds || []
|
73
77
|
end
|
74
78
|
end
|
data/lib/ci_toolkit/version.rb
CHANGED