in src/main/scala/com/gu/iosdeployments/Lambda.scala [66:84]
def handleProductionDeployment(maybeDeployment: Option[RunningLiveAppDeployment], latestProductionVersions: List[LiveAppProduction], gitHubConfig: GitHubConfig): Try[Unit] = maybeDeployment match {
case Some(productionDeployment) =>
val attemptToFindProductionVersion = latestProductionVersions.find(_.version == productionDeployment.version)
attemptToFindProductionVersion match {
case Some(LiveAppProduction(_, _, "READY_FOR_SALE")) =>
logger.info(s"Production deployment for version ${productionDeployment.version} is complete...")
GitHubApi.markDeploymentAsSuccess(gitHubConfig, productionDeployment)
// There are a few different ways a build can be rejected, see: https://developer.apple.com/documentation/appstoreconnectapi/appstoreversionstate
case Some(LiveAppProduction(_, _, status)) if status.contains("REJECTED") =>
logger.info(s"Production deployment for version ${productionDeployment.version} has been rejected...")
GitHubApi.markDeploymentAsFailure(gitHubConfig, productionDeployment)
case Some(liveAppProduction) =>
Try(logger.info(s"No action required for production deployment. Full details are: ${liveAppProduction}"))
case None =>
notPresentInAppStoreConnect(productionDeployment, gitHubConfig)
}
case None =>
Try(logger.info("No running production deployments found."))
}