class Fastlane::Actions::FirebaseAppDistributionAddTestersAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_add_testers_action.rb, line 43
def self.authors
  ["Tunde Agboola"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_add_testers_action.rb, line 52
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :project_number,
                                env_name: "FIREBASEAPPDISTRO_PROJECT_NUMBER",
                                description: "Your Firebase project number. You can find the project number in the Firebase console, on the General Settings page",
                                type: Integer,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :emails,
                                env_name: "FIREBASEAPPDISTRO_ADD_TESTERS_EMAILS",
                                description: "Comma separated list of tester emails to be created. A maximum of 1000 testers can be created at a time",
                                optional: true,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :file,
                                env_name: "FIREBASEAPPDISTRO_ADD_TESTERS_FILE",
                                description: "Path to a file containing a comma separated list of tester emails to be created. A maximum of 1000 testers can be deleted at a time",
                                optional: true,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :service_credentials_file,
                                description: "Path to Google service credentials file",
                                optional: true,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
                                 description: "Auth token for firebase cli",
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :debug,
                                 description: "Print verbose debug output",
                                 optional: true,
                                 default_value: false,
                                 is_string: false)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_add_testers_action.rb, line 39
def self.description
  "Create testers in bulk from a comma-separated list or a file"
end
details() click to toggle source

supports markdown.

# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_add_testers_action.rb, line 48
def self.details
  "Create testers in bulk from a comma-separated list or a file"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_add_testers_action.rb, line 85
def self.is_supported?(platform)
  true
end
run(params) click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_add_testers_action.rb, line 13
def self.run(params)
  auth_token = fetch_auth_token(params[:service_credentials_file], params[:firebase_cli_token])
  fad_api_client = Client::FirebaseAppDistributionApiClient.new(auth_token, params[:debug])

  if blank?(params[:emails]) && blank?(params[:file])
    UI.user_error!("Must specify `emails` or `file`.")
  end

  emails = string_to_array(get_value_from_value_or_file(params[:emails], params[:file]))

  UI.user_error!("Must pass at least one email") if blank?(emails)

  if emails.count > 1000
    UI.user_error!("A maximum of 1000 testers can be added at a time.")
  end

  UI.message("⏳ Adding #{emails.count} testers to project #{params[:project_number]}...")

  fad_api_client.add_testers(params[:project_number], emails)

  # The add_testers response lists all the testers from the request
  # regardless of whether or not they were created or if they already
  # exists so can't get an accurate count of the number of newly created testers
  UI.success("✅ Tester(s) successfully added.")
end