Skip to content

Commit 655e0dd

Browse files
committed
Use Fastlane's AccountManager to manage user in register_new_device
1 parent 66669cf commit 655e0dd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

fastlane/Fastfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,11 +599,13 @@ platform :ios do
599599
# We're about to use `add_development_certificates_to_provisioning_profiles` and `add_all_devices_to_provisioning_profiles`.
600600
# These actions use Developer Portal APIs that don't yet support authentication via API key (-.-').
601601
# Let's preemptively ask for and set the email here to avoid being asked twice for it if not set.
602-
asc_user_email_key = 'FASTLANE_USER'
603-
unless ENV.key?(asc_user_email_key)
604-
UI.important("#{asc_user_email_key} value not found in the environment.")
605-
ENV[asc_user_email_key] = UI.input('Please provide your Apple Developer Program account email (this will not be saved): ')
606-
end
602+
603+
require 'credentials_manager'
604+
605+
# If Fastlane cannot instantiate a user, it will ask the caller for the email.
606+
# Once we have it, we can set it as `FASTLANE_USER` in the environment (which has lifecycle limited to this call) so that the next commands will already have access to it.
607+
# Note that if the user is already available to `AccountManager`, setting it in the environment is redundant, but Fastlane doesn't provide a way to check it so we have to do it anyway.
608+
ENV['FASTLANE_USER'] = CredentialsManager::AccountManager.new.user
607609

608610
# Add all development certificates to the provisioning profiles (just in case – this is an easy step to miss)
609611
add_development_certificates_to_provisioning_profiles(

0 commit comments

Comments
 (0)