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 b5afe33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion bootstrap/src/main/scala/org/polyvariant/Gitlab.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import io.pg.gitlab.graphql.Project
import io.pg.gitlab.graphql.ProjectConnection
import io.pg.gitlab.graphql.Query
import io.pg.gitlab.graphql.UserCore
import cats.MonadError
import caliban.client.Operations.IsOperation
import sttp.model.Method
import cats.MonadThrow
Expand Down
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 b5afe33

Please sign in to comment.