ci_toolkit 1.2.4 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fe8ccc57c8be14185039c9c5131af47aa42b84eec881738d1e8f36033350b9f
4
- data.tar.gz: 5081c37c63b18871a5d9bf2810eb7ae56a5aff7b0b6358a4d878cb45f2de7348
3
+ metadata.gz: fcb2f396f954502fd4181fd9f96daedf067cf3800f5425b6b251515f4c4d81b0
4
+ data.tar.gz: 938bea990d63ced3c0f5b66d91ddec92a07ea0d8262536f81f6d149ce6da1bae
5
5
  SHA512:
6
- metadata.gz: aad731920fc42c0275af28c247c3163b0a252780d667a87da4c908ad6d226e41db95db9679bb91c1fd98fab0029309023cc9b7273b41064b80067bc14c030089
7
- data.tar.gz: 85cec32699fcdb392277efbf7f0385e6ce20440340de0603eb848dba8fc2188246674f2d441734ad478c01e13bb05bad680a804194fd8980ac040e6e748f4baa
6
+ metadata.gz: 64c8f72d6346a665bb43abf1e63ea1adc28fe183a3ccb1232120ad4e5ee1b1eddc015e87f8de2e6ed7655a417f53feda48f40ac9d2fca61b695fbf49f35acbcb
7
+ data.tar.gz: 7414b1b22c2da208fff9a266cdaa1cfb6657c9c6e29b1507c314d95544ab9b5453e4737638fb34bdde77f5af10e8741aa16fa37e6a2cc9d40fd3d9295fdad1c0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.2.4)
4
+ ci_toolkit (1.2.8)
5
5
  faraday
6
6
  faraday_middleware
7
7
  jwt
@@ -9,9 +9,16 @@ module CiToolkit
9
9
  API_VERSION = "v0.1"
10
10
  attr_reader :connection
11
11
 
12
- def initialize(token = ENV["BITRISE_TOKEN"], app_slug = ENV["BITRISE_APP_SLUG"], faraday = nil)
13
- @token = token
14
- @app_slug = app_slug
12
+ # noinspection Metrics/ParameterLists
13
+ def initialize(options = {
14
+ build_number: ENV["BITRISE_BUILD_NUMBER"],
15
+ token: ENV["BITRISE_TOKEN"],
16
+ app_slug: ENV["BITRISE_APP_SLUG"]
17
+ },
18
+ faraday = nil)
19
+ @build_number = options[:build_number].to_i
20
+ @token = options[:token]
21
+ @app_slug = options[:app_slug]
15
22
  @connection = faraday
16
23
  configure_connection
17
24
  @connection&.use Faraday::Response::Logger, nil, { headers: true, bodies: true }
@@ -26,8 +33,8 @@ module CiToolkit
26
33
  )
27
34
  @connection.use Faraday::Request::UrlEncoded
28
35
  @connection.use Faraday::Request::Retry
29
- @connection.use FaradayMiddleware::ParseJson
30
36
  @connection.use FaradayMiddleware::EncodeJson
37
+ @connection.use FaradayMiddleware::ParseJson
31
38
  @connection.use FaradayMiddleware::FollowRedirects
32
39
  end
33
40
 
@@ -46,7 +53,7 @@ module CiToolkit
46
53
 
47
54
  def abort_pull_request_builds(pull_request, branch, commit)
48
55
  find_pull_request_builds(pull_request, branch, commit).each do |build|
49
- @connection&.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build[:slug]}/abort", {
56
+ @connection&.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build["slug"]}/abort", {
50
57
  abort_reason: "Aborting due to other build failed for pull request #{pull_request}"
51
58
  })
52
59
  end
@@ -61,14 +68,14 @@ module CiToolkit
61
68
  puts "Response:\n"
62
69
  puts response.inspect
63
70
 
64
- builds = response[:response_body][:data]
71
+ builds = response.body["data"]
65
72
  filter_builds_by_commit(builds, commit)
66
73
  end
67
74
 
68
75
  def filter_builds_by_commit(builds, commit)
69
76
  puts "Builds:\n"
70
77
  puts builds.inspect
71
- builds&.select! { |build| build[:commit_hash] == commit }
78
+ builds&.select! { |build| build["commit_hash"] == commit && build["build_number"] != @build_number }
72
79
  builds || []
73
80
  end
74
81
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CiToolkit
4
- VERSION = "1.2.4"
4
+ VERSION = "1.2.8"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gero Keller