Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
majk-p committed Jun 9, 2021
1 parent e73fb2f commit 9ed6734
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bootstrap/src/main/scala/org/polyvariant/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object Main extends IOApp {
Logger[F].info(s"ID: ${mr.mergeRequestIid} by: ${mr.authorUsername}")
}.void

private def qualifyMergeRequests(botUserName: String, mergeRequests: List[MergeRequestInfo]): List[MergeRequestInfo] =
private def qualifyMergeRequestsForDeletion(botUserName: String, mergeRequests: List[MergeRequestInfo]): List[MergeRequestInfo] =
mergeRequests.filter(_.authorUsername == botUserName)

private def program[F[_]: Logger: Async](args: List[String]): F[Unit] =
Expand All @@ -30,14 +30,14 @@ object Main extends IOApp {
mrs <- gitlab.mergeRequests(config.project)
_ <- Logger[F].info(s"Merge requests found: ${mrs.length}")
_ <- printMergeRequests(mrs)
botMrs = qualifyMergeRequests(config.botUser, mrs)
botMrs = qualifyMergeRequestsForDeletion(config.botUser, mrs)
_ <- Logger[F].info(s"Will delete merge requests: ${botMrs.map(_.mergeRequestIid)}")
_ <- botMrs.traverse(mr => gitlab.deleteMergeRequest(config.project, mr.mergeRequestIid))
_ <- Logger[F].info("Done processing merge requests")
} yield ()

override def run(args: List[String]): IO[ExitCode] = {
given logger: Logger[IO] = Logger.wrappedPrint[IO]
given Logger[IO] = Logger.wrappedPrint[IO]
program[IO](args) *>
IO.pure(ExitCode.Success)
}
Expand Down

0 comments on commit 9ed6734

Please sign in to comment.