Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not run the 'dependency-submission' job in CI for forked repositories #720

Merged
merged 3 commits into from
Sep 5, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ jobs:

dependency-submission:
name: Submit Dependencies
if: github.event_name != 'pull_request'
if: github.event.repository.fork == false && github.event_name != 'pull_request'
strategy:
matrix:
os: [ubuntu-latest]
Expand Down
10 changes: 9 additions & 1 deletion ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ object TypelevelCiPlugin extends AutoPlugin {
lazy val tlCiStewardValidateConfig = settingKey[Option[File]](
"The location of the Scala Steward config to validate (default: `.scala-steward.conf`, if exists)")

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

}

import autoImport._
Expand All @@ -64,6 +68,7 @@ object TypelevelCiPlugin extends AutoPlugin {
tlCiMimaBinaryIssueCheck := false,
tlCiDocCheck := false,
tlCiDependencyGraphJob := true,
tlCiForkCondition := "github.event.repository.fork == false",
githubWorkflowTargetBranches ++= Seq(
"!update/**", // ignore steward branches
"!pr/**" // escape-hatch to disable ci on a branch
Expand Down Expand Up @@ -139,6 +144,9 @@ object TypelevelCiPlugin extends AutoPlugin {
},
githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")),
githubWorkflowAddedJobs ++= {
val ghEventCond = "github.event_name != 'pull_request'"
val jobCond = s"${tlCiForkCondition.value} && $ghEventCond"

val dependencySubmission =
if (tlCiDependencyGraphJob.value)
List(
Expand All @@ -155,7 +163,7 @@ object TypelevelCiPlugin extends AutoPlugin {
Some(List("test", "scala-tool", "scala-doc-tool", "test-internal")),
None
),
cond = Some("github.event_name != 'pull_request'")
cond = Some(jobCond)
))
else Nil

Expand Down
3 changes: 2 additions & 1 deletion docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ Both plugins are documented in [**sbt-typelevel-github-actions**](gha.md).
- `tlCiScalafixCheck` (setting): Whether to do scalafix check in CI (default: `false`).
- `tlCiMimaBinaryIssueCheck` (setting): Whether to do MiMa binary issues check in CI (default: `false`).
- `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`)
- `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`).
- `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