diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala index d4ba79d6..5825d9d3 100644 --- a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -18,10 +18,11 @@ package org.typelevel.sbt import org.typelevel.sbt.NoPublishGlobalPlugin.noPublishModulesIgnore import org.typelevel.sbt.gha.GenerativePlugin -import org.typelevel.sbt.gha.GenerativePlugin.autoImport._ +import org.typelevel.sbt.gha.GenerativePlugin.autoImport.* import org.typelevel.sbt.gha.GitHubActionsPlugin import org.typelevel.sbt.gha.WorkflowStep -import sbt._ +import org.typelevel.sbt.kernel.GitHelper +import sbt.* import scala.language.experimental.macros @@ -140,7 +141,13 @@ object TypelevelCiPlugin extends AutoPlugin { githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")), githubWorkflowAddedJobs ++= { val dependencySubmission = - if (tlCiDependencyGraphJob.value) + if (tlCiDependencyGraphJob.value) { + val githubRepo = GitHelper.extractGitHubUserRepo.map(x => x._1 + '/' + x._2) + val jobCondition = + githubRepo.fold( + "github.event_name != 'pull_request'" + )(repo => s"github.repository == '$repo' && github.event_name != 'pull_request'") + List( WorkflowJob( "dependency-submission", @@ -155,9 +162,9 @@ object TypelevelCiPlugin extends AutoPlugin { Some(List("test", "scala-tool", "scala-doc-tool", "test-internal")), None ), - cond = Some("github.event_name != 'pull_request'") + cond = Some(jobCondition) )) - else Nil + } else Nil dependencySubmission },