def workflowRunsForBranch()

in app/services/GithubAPI.scala [152:171]


  def workflowRunsForBranch(projectId:String, branchName:String) = {
    getHttp
      .singleRequest(makeRequest("repos", s"$projectId/actions/runs?branch=${URLEncoder.encode(branchName, StandardCharsets.UTF_8)}"))
      .flatMap(response=>{
        (response.status: @switch) match {
          case StatusCodes.OK=>
            for {
              serverContent <- unmarshalContent[WorkflowRunsResponse](consumeResponseContent(response))
              result <- Future(serverContent.map(_.workflow_runs))
            } yield result
          case StatusCodes.NotFound=>
            Future(Right(Seq()))
          case _=>
            consumeResponseContent(response).flatMap(content=> {
              logger.error(s"Could not get workflow runs for branch $branchName of $projectId, server returned ${response.status} ${content.utf8String}")
              Future.failed(new RuntimeException("External server error"))
            })
        }
      })
  }