precheck/lib/precheck/runner.rb in fastlane-2.159.0 vs precheck/lib/precheck/runner.rb in fastlane-2.160.0

- old
+ new

@@ -16,11 +16,24 @@ FastlaneCore::PrintTable.print_values(config: Precheck.config, hide_keys: [:output_path], title: "Summary for precheck #{Fastlane::VERSION}") - unless Spaceship::Tunes.client + if api_token + + # As of 2020-09-15, App Store Connect API does not have support for IAPs yet + # This means that API Key will fail if checking for IAPs. + # + # There is also a check in Deliver::Runner for this. + # Please remove check in Deliver when the API support IAPs. + if Precheck.config[:include_in_app_purchases] + UI.user_error!("Precheck cannot check In-app purchases with the App Store Connect API Key (yet). Exclude In-app purchases from precheck or use Apple ID login") + end + + UI.message("Creating authorization token for App Store Connect API") + Spaceship::ConnectAPI.token = api_token + elsif Spaceship::Tunes.client.nil? # Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables # Prompts select team if multiple teams and none specified UI.message("Starting login with user '#{Precheck.config[:username]}'") Spaceship::ConnectAPI.login(Precheck.config[:username], use_portal: false, use_tunes: true) @@ -54,9 +67,15 @@ if !processor_result.has_errors_or_warnings? && !processor_result.items_not_checked? UI.message("precheck 👮‍♀️ 👮 finished without detecting any potential problems 🛫".green) end return true + end + + def api_token + @api_token ||= Spaceship::ConnectAPI::Token.create(Precheck.config[:api_key]) if Precheck.config[:api_key] + @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(Precheck.config[:api_key_path]) if Precheck.config[:api_key_path] + return @api_token end def print_items_not_checked(processor_result: nil) names = processor_result.items_not_checked.map(&:friendly_name) UI.message("😶 Metadata fields not checked by any rule: #{names.join(', ')}".yellow) if names.length > 0