fastlane/lib/fastlane/runner.rb in fastlane-2.139.0 vs fastlane/lib/fastlane/runner.rb in fastlane-2.140.0

- old
+ new

@@ -223,38 +223,43 @@ verify_supported_os(method_sym, class_ref) begin Dir.chdir(custom_dir) do # go up from the fastlane folder, to the project folder - # If another action is calling this action, we shouldn't show it in the summary + # Removing step_name before its parsed into configurations + args = arguments.kind_of?(Array) && arguments.first.kind_of?(Hash) ? arguments.first : {} + step_name = args.delete(:step_name) + # arguments is an array by default, containing an hash with the actual parameters + # Since we usually just need the passed hash, we'll just use the first object if there is only one + if arguments.count == 0 + configurations = ConfigurationHelper.parse(class_ref, {}) # no parameters => empty hash + elsif arguments.count == 1 && arguments.first.kind_of?(Hash) + configurations = ConfigurationHelper.parse(class_ref, arguments.first) # Correct configuration passed + elsif !class_ref.available_options + # This action does not use the new action format + # Just passing the arguments to this method + configurations = arguments + else + UI.user_error!("You have to call the integration like `#{method_sym}(key: \"value\")`. Run `fastlane action #{method_sym}` for all available keys. Please check out the current documentation on GitHub.") + end + + # If another action is calling this action, we shouldn't show it in the summary + # A nil value for action_name will hide it from the summary unless from_action - args = arguments.kind_of?(Array) && arguments.first.kind_of?(Hash) ? arguments.first : {} - action_name = args[:step_name] || class_ref.step_text - args.delete(:step_name) + action_name = step_name + action_name ||= class_ref.method(:step_text).arity == 1 ? class_ref.step_text(configurations) : class_ref.step_text end - Actions.execute_action(action_name) do - # arguments is an array by default, containing an hash with the actual parameters - # Since we usually just need the passed hash, we'll just use the first object if there is only one - if arguments.count == 0 - arguments = ConfigurationHelper.parse(class_ref, {}) # no parameters => empty hash - elsif arguments.count == 1 && arguments.first.kind_of?(Hash) - arguments = ConfigurationHelper.parse(class_ref, arguments.first) # Correct configuration passed - elsif !class_ref.available_options - # This action does not use the new action format - # Just passing the arguments to this method - else - UI.user_error!("You have to call the integration like `#{method_sym}(key: \"value\")`. Run `fastlane action #{method_sym}` for all available keys. Please check out the current documentation on GitHub.") - end + Actions.execute_action(action_name) do if Fastlane::Actions.is_deprecated?(class_ref) puts("==========================================".deprecated) puts("This action (#{method_sym}) is deprecated".deprecated) puts(class_ref.deprecated_notes.to_s.remove_markdown.deprecated) if class_ref.deprecated_notes puts("==========================================\n".deprecated) end class_ref.runner = self # needed to call another action from an action - return class_ref.run(arguments) + return class_ref.run(configurations) end end rescue Interrupt => e raise e # reraise the interruption to avoid logging this as a crash rescue FastlaneCore::Interface::FastlaneCommonException => e # these are exceptions that we don't count as crashes