Skip to content
Open
Show file tree
Hide file tree
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
40 changes: 20 additions & 20 deletions ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ object TypelevelCiPlugin extends AutoPlugin {
settingKey[String](
"Condition for checking on CI whether this project is a fork of another (default: `github.event.repository.fork == false`)")

lazy val tlCiLintCommands = settingKey[Seq[String]](
"sbt commands run in the 'Check headers and formatting' CI step (default: derived from `tlCiHeaderCheck`, `tlCiScalafmtCheck`, and `tlCiJavafmtCheck`)")

}

import autoImport._
Expand All @@ -69,6 +72,19 @@ object TypelevelCiPlugin extends AutoPlugin {
tlCiDocCheck := false,
tlCiDependencyGraphJob := true,
tlCiForkCondition := "github.event.repository.fork == false",
tlCiLintCommands := {
val headers = List("headerCheckAll").filter(_ => tlCiHeaderCheck.value)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me wonder if tlCiHeaderCheck should just be deprecated in favor of it being the default here. But probably not

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, wdym?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that instead of the current state we could have a default value of tlCiLintCommands := List("headerCheckAll", "scalafmtAll"), and get rid of tlCiHeaderCheck as a key. If someone wants to opt out of header checks, they can modify tlCiLintCommands.


val scalafmt = List(
"scalafmtCheckAll",
"project /",
Copy link
Copy Markdown
Member

@armanbilge armanbilge May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, one thing to note, is that project / actually changes the state of the shell. So it makes a difference if commands are before or after this.

"scalafmtSbtCheck"
).filter(_ => tlCiScalafmtCheck.value)

val javafmt = List("javafmtCheckAll").filter(_ => tlCiJavafmtCheck.value)

headers ++ javafmt ++ scalafmt
},
githubWorkflowTargetBranches ++= Seq(
"!update/**", // ignore steward branches
"!pr/**" // escape-hatch to disable ci on a branch
Expand All @@ -77,31 +93,15 @@ object TypelevelCiPlugin extends AutoPlugin {
githubWorkflowBuild := {

val style = {
val headers = List("headerCheckAll").filter(_ => tlCiHeaderCheck.value)

val scalafmt = List(
"scalafmtCheckAll",
"project /",
"scalafmtSbtCheck"
).filter(_ => tlCiScalafmtCheck.value)

val javafmt = List("javafmtCheckAll").filter(_ => tlCiJavafmtCheck.value)

val formatting = javafmt ++ scalafmt

val headersFormatting = headers ++ formatting

val names =
List("headers").filter(_ => headers.nonEmpty) ++ List("formatting").filter(_ =>
formatting.nonEmpty)
val commands = tlCiLintCommands.value.toList

List(
WorkflowStep.Sbt(
headers ++ formatting,
name = Some(s"Check ${names.mkString(" and ")}"),
commands,
name = Some("Check headers and formatting"),
cond = Some(primaryAxisCond.value)
)
).filter(_ => headersFormatting.nonEmpty)
).filter(_ => commands.nonEmpty)
}

val test = List(
Expand Down
1 change: 1 addition & 0 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Both plugins are documented in [**sbt-typelevel-github-actions**](gha.md).
- `tlCiDocCheck` (setting): Whether to build API docs in CI (default: `false`).
- `tlCiDependencyGraphJob` (setting): Whether to add a job to submit dependencies to GH (default: `true`).
- `tlCiForkCondition` (setting): Condition for checking on CI whether this project is a fork of another (default: `github.event.repository.fork == false`).
- `tlCiLintCommands` (setting): sbt commands run in the "Check headers and formatting" CI step. Defaults are derived from `tlCiHeaderCheck`, `tlCiScalafmtCheck`, and `tlCiJavafmtCheck`. Append your own check (e.g. `tlCiLintCommands += "myLintCheckAll"`) to fold it into the same step. Scalafix is gated separately via `tlCiScalafixCheck` and runs as its own step.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bikeshedding the name ... the idea is to separate "fast" commands (formatting, headers) from "slow" commands (Scalafix, which often requires compiling the code). But I'm not sure if "lint" fully captures that, since arguably Scalafix is also a form of linting.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint -> FastLint would be fine with me :)

- `tlCiStewardValidateConfig` (setting): The location of the Scala Steward config to validate (default: `.scala-steward.conf`, if exists).
- `tlCrossRootProject` (method): helper to create a `root` project that can aggregate both `Project`s and `CrossProject`s. Automatically creates separate jobs in the CI matrix for each platform (JVM, JS, etc.).

Expand Down
Loading