Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,7 @@ object TypelevelPlugin extends AutoPlugin {
java <- githubWorkflowJavaVersions.value.tail // default java is head
} yield MatrixExclude(Map("scala" -> scala, "java" -> java.render))
}
) ++ addPrePRCommandAlias ++ addCommandAlias(
"tlPrePrBotHook",
mkCommand(
List(
"githubWorkflowGenerate",
"+headerCreateAll",
"+scalafmtAll",
"scalafmtSbt"
)
)
)
) ++ addPrePRCommandAlias ++ addTlPrePRBotHookCommandAlias

// partially re-implemnents addCommandAlias
// this is so we can use the value of other settings to generate command
Expand All @@ -114,4 +104,25 @@ object TypelevelPlugin extends AutoPlugin {
}
)

private def addTlPrePRBotHookCommandAlias: Seq[Setting[_]] = Seq(
GlobalScope / onLoad := {
val header = tlCiHeaderCheck.value
val scalafmt = tlCiScalafmtCheck.value

(GlobalScope / Keys.onLoad).value.compose { (state: State) =>
val command = mkCommand(
List("githubWorkflowGenerate") ++
List("+headerCreateAll").filter(_ => header) ++
List("+scalafmtAll", "scalafmtSbt").filter(_ => scalafmt)
)
BasicCommands.addAlias(state, "tlPrePrBotHook", command)
}
},
GlobalScope / Keys.onUnload := {
(GlobalScope / Keys.onUnload)
.value
.compose((state: State) => BasicCommands.removeAlias(state, "tlPrePrBotHook"))
}
)

}