class Fastlane::Actions::GetCircleCiArtifactsAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/get_circle_ci_artifacts.rb, line 90
def self.authors
  ["crazymanish"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/get_circle_ci_artifacts.rb, line 36
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :api_token,
                                 env_name: "FL_GET_CIRCLE_CI_ARTIFACTS_API_TOKEN",
                                 description: "API Token for CircleCI API",
                                 sensitive: true,
                                 code_gen_sensitive: true,
                                 is_string: true,
                                 default_value: ENV["CIRCLE_CI_API_TOKEN"],
                                 default_value_dynamic: true,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :vcs_type,
                                 env_name: "FL_GET_CIRCLE_CI_ARTIFACTS_VCS_TYPE",
                                 description: "CircleCI vcs type i.e github/bitbucket",
                                 is_string: true,
                                 default_value: "github"),
    FastlaneCore::ConfigItem.new(key: :user_name,
                                 env_name: "FL_GET_CIRCLE_CI_ARTIFACTS_USER_NAME",
                                 description: "CircleCI project repo user name i.e For github repo 'crazymanish/some_repo_name', user_name will be 'crazymanish'",
                                 is_string: true,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :project_name,
                                 env_name: "FL_GET_CIRCLE_CI_ARTIFACTS_PROJECT_NAME",
                                 description: "CircleCI project repo project name i.e For github repo 'crazymanish/some_repo_name', project_name will be 'some_repo_name'",
                                 is_string: true,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :build_number,
                                 env_name: "FL_GET_CIRCLE_CI_ARTIFACTS_BUILD_NUMBER",
                                 description: "CircleCI build number",
                                 is_string: true,
                                 optional: false)
  ]
end
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/circle_ci/actions/get_circle_ci_artifacts.rb, line 32
def self.description
  "List the CircleCI artifacts."
end
example_code() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/get_circle_ci_artifacts.rb, line 80
def self.example_code
  [
    'get_circle_ci_artifacts(
      user_name: "crazymanish",
      project_name: "some_repo_name",
      build_number: "1234"
    )'
  ]
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/get_circle_ci_artifacts.rb, line 94
def self.is_supported?(platform)
  true
end
output() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/get_circle_ci_artifacts.rb, line 70
def self.output
  [
    ['GET_CIRCLE_CI_ARTIFACTS_RESULT', 'An array of artifacts']
  ]
end
return_value() click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/get_circle_ci_artifacts.rb, line 76
def self.return_value
  "Returns an array of artifacts produced by a given build."
end
run(params) click to toggle source
# File lib/fastlane/plugin/circle_ci/actions/get_circle_ci_artifacts.rb, line 11
def self.run(params)
  token = params[:api_token]
  vcs = params[:vcs_type]
  name = params[:user_name]
  project = params[:project_name]
  build = params[:build_number]

  uri = "https://circleci.com"
  api_url = "api/v1.1/project/#{vcs}/#{name}/#{project}/#{build}/artifacts"
  curl_command = "curl -H 'Content-Type: application/json' -H 'Circle-Token: #{token}' -s #{uri}/#{api_url}"

  result = Helper::CircleCiHelper.execute(curl_command)

  Actions.lane_context[SharedValues::GET_CIRCLE_CI_ARTIFACTS_RESULT] = result
  result
end