Class: Fastlane::Actions::BitriseBuildStatusAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_status_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



35
36
37
# File 'lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_status_action.rb', line 35

def self.authors
  ["Mario Cecchi", "Henrique Alves"]
end

.available_optionsObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_status_action.rb', line 43

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :app_slug,
                            env_name: "BITRISE_APP_SLUG",
                         description: "The app slug of the project on Bitrise",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :access_token,
                            env_name: "BITRISE_ACCESS_TOKEN",
                         description: "The personal access token used to call Bitrise API",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :build_slug,
                            env_name: "BITRISE_BUILD_SLUG",
                         description: "The slug that identifies the build on Bitrise",
                            optional: false,
                                type: String)
  ]
end

.descriptionObject



31
32
33
# File 'lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_status_action.rb', line 31

def self.description
  "Get the status of the Bitrise build"
end

.get_status(params, build_slug) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_status_action.rb', line 14

def self.get_status(params, build_slug)
  response = Helper::BitriseRequestHelper.get(params, "builds/#{build_slug}")

  if response.code == "200"
    json_response = JSON.parse(response.body)['data']
  else
    UI.crash!("Error fetching build status on Bitrise.io. Status code: #{response.code}. #{response}")
  end

  build_infos = {}
  build_infos["is_on_hold"] = json_response["is_on_hold"]
  build_infos["status"] = json_response["status"]
  build_infos["status_text"] = json_response["status_text"]
  build_infos["abort_reason"] = json_response["abort_reason"]
  build_infos
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_status_action.rb', line 63

def self.is_supported?(platform)
  true
end

.return_valueObject



39
40
41
# File 'lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_status_action.rb', line 39

def self.return_value
  "Returns the information of the Bitrise build"
end

.run(params) ⇒ Object



7
8
9
10
11
12
# File 'lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_status_action.rb', line 7

def self.run(params)
  status = get_status(params, params[:build_slug])
  FastlaneCore::PrintTable.print_values(config: status,
                                        title: "Bitrise build '#{params[:build_slug]}' status")
  status
end