Skip to content

Commit

Permalink
Improved prePR
Browse files Browse the repository at this point in the history
  • Loading branch information
zarthross committed Aug 3, 2024
1 parent 17ac909 commit aa53636
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
14 changes: 10 additions & 4 deletions core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,30 @@ object TypelevelPlugin extends AutoPlugin {
java <- githubWorkflowJavaVersions.value.tail // default java is head
} yield MatrixExclude(Map("scala" -> scala, "java" -> java.render))
},
GlobalScope / tlCommandAliases ++= {
GlobalScope / tlPrePRSteps ++= {
val header = tlCiHeaderCheck.value
val scalafmt = tlCiScalafmtCheck.value
val javafmt = tlCiJavafmtCheck.value
val scalafix = tlCiScalafixCheck.value

val prePR = List("project /", "githubWorkflowGenerate") ++
List("project /", "githubWorkflowGenerate") ++
List("+headerCreateAll").filter(_ => header) ++
List("+scalafixAll").filter(_ => scalafix) ++
List("+scalafmtAll", "scalafmtSbt").filter(_ => scalafmt) ++
List("javafmtAll").filter(_ => javafmt)
List("javafmtAll").filter(_ => javafmt) ++
List("compile", "test")
},
GlobalScope / tlCommandAliases ++= {
val header = tlCiHeaderCheck.value
val scalafmt = tlCiScalafmtCheck.value
val javafmt = tlCiJavafmtCheck.value

val botHook = List("githubWorkflowGenerate") ++
List("+headerCreateAll").filter(_ => header) ++
List("javafmtAll").filter(_ => javafmt) ++
List("+scalafmtAll", "scalafmtSbt").filter(_ => scalafmt)

Map(
"prePR" -> prePR,
"tlPrePrBotHook" -> botHook
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ object TypelevelKernelPlugin extends AutoPlugin {
"Command aliases defined for this build"
)

lazy val tlPrePRSteps =
settingKey[List[String]]("Steps to be performed before a user submits a PR")

@deprecated(
"Use `tlCommandAliases` for a more composable command definition experience",
"0.6.1")
Expand All @@ -62,7 +65,8 @@ object TypelevelKernelPlugin extends AutoPlugin {
override def globalSettings = Seq(
Def.derive(tlIsScala3 := scalaVersion.value.startsWith("3.")),
tlCommandAliases := Map(
"tlReleaseLocal" -> List("reload", "project /", "+publishLocal")
"tlReleaseLocal" -> List("reload", "project /", "+publishLocal"),
"prePR" -> ("reload" :: "project /" :: tlPrePRSteps.value)
),
onLoad := {
val aliases = tlCommandAliases.value
Expand All @@ -78,7 +82,8 @@ object TypelevelKernelPlugin extends AutoPlugin {
onUnload.value.compose { (state: State) =>
aliases.foldLeft(state) { (state, alias) => BasicCommands.removeAlias(state, alias) }
}
}
},
tlPrePRSteps := List.empty
)

@nowarn("cat=deprecation")
Expand Down

0 comments on commit aa53636

Please sign in to comment.