in modules/core/src/main/scala/org/scalasteward/core/edit/hooks/HookExecutor.scala [149:199]
private def sbtGithubWorkflowGenerateHook(
groupId: GroupId,
artifactId: ArtifactId,
enabledByCache: RepoCache => Boolean
): PostUpdateHook =
PostUpdateHook(
groupId = Some(groupId),
artifactId = Some(artifactId),
command = Nel.of("sbt", "githubWorkflowGenerate"),
useSandbox = true,
commitMessage = _ => CommitMsg("Regenerate GitHub Actions workflow"),
enabledByCache = enabledByCache,
enabledByConfig = _ => true,
addToGitBlameIgnoreRevs = false
)
private val scalafmtHook =
PostUpdateHook(
groupId = Some(scalafmtGroupId),
artifactId = Some(scalafmtArtifactId),
command = ScalafmtAlg.postUpdateHookCommand,
useSandbox = false,
commitMessage = update => CommitMsg(s"Reformat with scalafmt ${update.nextVersion}"),
enabledByCache = _ => true,
enabledByConfig = _.scalafmtOrDefault.runAfterUpgradingOrDefault,
addToGitBlameIgnoreRevs = true
)
private def sbtTypelevelHook(
groupId: GroupId,
artifactId: ArtifactId
): PostUpdateHook =
PostUpdateHook(
groupId = Some(groupId),
artifactId = Some(artifactId),
command = Nel.of("sbt", "tlPrePrBotHook"),
useSandbox = true,
commitMessage = _ => CommitMsg("Run prePR with sbt-typelevel"),
enabledByCache = _ => true,
enabledByConfig = _ => true,
addToGitBlameIgnoreRevs = false
)
private def githubWorkflowGenerateExists(cache: RepoCache): Boolean =
cache.dependsOn(sbtGitHubWorkflowGenerateModules ++ sbtTypelevelModules)
private val postUpdateHooks: List[PostUpdateHook] =
scalafmtHook ::
sbtGitHubWorkflowGenerateModules.map { case (gid, aid) =>
sbtGithubWorkflowGenerateHook(gid, aid, _ => true)
} ++