pilot/lib/pilot/build_manager.rb in fastlane-2.220.0 vs pilot/lib/pilot/build_manager.rb in fastlane-2.221.0

- old
+ new

@@ -366,15 +366,20 @@ def should_update_localized_build_information?(options) !options[:localized_build_info].nil? end def reject_build_waiting_for_review(build) - waiting_for_review_build = build.app.get_builds(filter: { "betaAppReviewSubmission.betaReviewState" => "WAITING_FOR_REVIEW" }, includes: "betaAppReviewSubmission,preReleaseVersion").first + waiting_for_review_build = build.app.get_builds( + filter: { "betaAppReviewSubmission.betaReviewState" => "WAITING_FOR_REVIEW,IN_REVIEW", + "expired" => false, + "preReleaseVersion.version" => build.pre_release_version.version }, + includes: "betaAppReviewSubmission,preReleaseVersion" + ).first unless waiting_for_review_build.nil? UI.important("Another build is already in review. Going to remove that build and submit the new one.") - UI.important("Deleting beta app review submission for build: #{waiting_for_review_build.app_version} - #{waiting_for_review_build.version}") - waiting_for_review_build.beta_app_review_submission.delete! - UI.success("Deleted beta app review submission for previous build: #{waiting_for_review_build.app_version} - #{waiting_for_review_build.version}") + UI.important("Canceling beta app review submission for build: #{waiting_for_review_build.app_version} - #{waiting_for_review_build.version}") + waiting_for_review_build.expire! + UI.success("Canceled beta app review submission for previous build: #{waiting_for_review_build.app_version} - #{waiting_for_review_build.version}") end end def expire_previous_builds(build) builds_to_expire = build.app.get_builds.reject do |asc_build|