override def artifactsZipForBranch()

in app/services/GithubAPI.scala [180:209]


  override def artifactsZipForBranch(projectId: String, branchName: String, jobName: String): Future[Option[ByteString]] = {
    for {
      maybeRun <- workflowRunsForBranch(projectId, branchName).map({
        case Left(err)=>
          logger.error(s"Could not parse workflow runs response for branch $branchName of project $projectId: $err")
          throw new RuntimeException("Bad response from server")
        case Right(runs)=>
          runs.sortBy(_.run_number)(Ordering.Int.reverse).headOption
      })
      artifacts <- if(maybeRun.isDefined) listArtifacts(maybeRun.get.artifacts_url) else Future(Right(Seq()))
      maybeArtifactInfo <- artifacts match {
        case Left(err)=>
          logger.error(s"Could not parse artifact list response for branch $branchName of project $projectId: $err")
          throw new RuntimeException("Bad response from server")
        case Right(results)=>
          if(results.length>1) {
            Future(
              results
                .filter(art=>art.name=="build-info" || art.name==jobName)
                .filter(!_.expired)
                .sortBy(_.created_at)
                .headOption
            )
          } else {
            Future(results.find(!_.expired))
          }
      }
      content <- if(maybeArtifactInfo.isDefined) downloadArtifactsZip(maybeArtifactInfo.get.archive_download_url).map(Some.apply) else Future(None)
    } yield content
  }