Skip to content

Commit b48f58e

Browse files
authored
Merge pull request #720 from danicheg/tweak-dependency-submission
Do not run the 'dependency-submission' job in CI for forked repositories
2 parents 4674a76 + 7920f23 commit b48f58e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ jobs:
393393

394394
dependency-submission:
395395
name: Submit Dependencies
396-
if: github.event_name != 'pull_request'
396+
if: github.event.repository.fork == false && github.event_name != 'pull_request'
397397
strategy:
398398
matrix:
399399
os: [ubuntu-latest]

ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ object TypelevelCiPlugin extends AutoPlugin {
5252
lazy val tlCiStewardValidateConfig = settingKey[Option[File]](
5353
"The location of the Scala Steward config to validate (default: `.scala-steward.conf`, if exists)")
5454

55+
lazy val tlCiForkCondition =
56+
settingKey[String](
57+
"Condition for checking on CI whether this project is a fork of another (default: `github.event.repository.fork == false`)")
58+
5559
}
5660

5761
import autoImport._
@@ -64,6 +68,7 @@ object TypelevelCiPlugin extends AutoPlugin {
6468
tlCiMimaBinaryIssueCheck := false,
6569
tlCiDocCheck := false,
6670
tlCiDependencyGraphJob := true,
71+
tlCiForkCondition := "github.event.repository.fork == false",
6772
githubWorkflowTargetBranches ++= Seq(
6873
"!update/**", // ignore steward branches
6974
"!pr/**" // escape-hatch to disable ci on a branch
@@ -139,6 +144,9 @@ object TypelevelCiPlugin extends AutoPlugin {
139144
},
140145
githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")),
141146
githubWorkflowAddedJobs ++= {
147+
val ghEventCond = "github.event_name != 'pull_request'"
148+
val jobCond = s"${tlCiForkCondition.value} && $ghEventCond"
149+
142150
val dependencySubmission =
143151
if (tlCiDependencyGraphJob.value)
144152
List(
@@ -155,7 +163,7 @@ object TypelevelCiPlugin extends AutoPlugin {
155163
Some(List("test", "scala-tool", "scala-doc-tool", "test-internal")),
156164
None
157165
),
158-
cond = Some("github.event_name != 'pull_request'")
166+
cond = Some(jobCond)
159167
))
160168
else Nil
161169

docs/customization.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ Both plugins are documented in [**sbt-typelevel-github-actions**](gha.md).
6666
- `tlCiScalafixCheck` (setting): Whether to do scalafix check in CI (default: `false`).
6767
- `tlCiMimaBinaryIssueCheck` (setting): Whether to do MiMa binary issues check in CI (default: `false`).
6868
- `tlCiDocCheck` (setting): Whether to build API docs in CI (default: `false`).
69-
- `tlCiDependencyGraphJob` (setting): Whether to add a job to submit dependencies to GH (default: `true`)
69+
- `tlCiDependencyGraphJob` (setting): Whether to add a job to submit dependencies to GH (default: `true`).
70+
- `tlCiForkCondition` (setting): Condition for checking on CI whether this project is a fork of another (default: `github.event.repository.fork == false`).
7071
- `tlCiStewardValidateConfig` (setting): The location of the Scala Steward config to validate (default: `.scala-steward.conf`, if exists).
7172
- `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.).
7273

0 commit comments

Comments
 (0)