From 1c9cbd0a124cdf5626605e1e4419130f885364a7 Mon Sep 17 00:00:00 2001 From: Fabio Pinheiro Date: Fri, 2 Aug 2024 18:39:44 +0100 Subject: [PATCH] fix: #1259 make GITHUB_TOKEN optional (#1275) Signed-off-by: FabioPinheiro --- build.sbt | 2 -- project/plugins.sbt | 13 ++++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 8a6c8a299a..815436aa72 100644 --- a/build.sbt +++ b/build.sbt @@ -11,8 +11,6 @@ inThisBuild( run / connectInput := true, releaseUseGlobalVersion := false, versionScheme := Some("semver-spec"), - githubOwner := "hyperledger", - githubRepository := "identus-cloud-agent", resolvers += "Local Maven Repository" at "file://" + Path.userHome.absolutePath + "/.m2/repository", resolvers += "jitpack" at "https://jitpack.io", ) diff --git a/project/plugins.sbt b/project/plugins.sbt index 9bdfcf08f7..6bfc5d042a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,7 +2,6 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0") -addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.12") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.11") @@ -10,3 +9,15 @@ addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6") // In order to import proper version of com.google.protobuf.ByteString we need to add this dependency libraryDependencies ++= Seq("com.thesamet.scalapb" %% "compilerplugin" % "0.11.17") + +// Github Packages +if (sys.env.get("GITHUB_TOKEN").isDefined) { + println(s"Enable plugin sbt-dependency-tree since env GITHUB_TOKEN is defined.") + // The reason for this is that the plugin needs the variable to be defined. We don't want to have that requirement. + libraryDependencies += { + val dependency = "com.codecommit" % "sbt-github-packages" % "0.5.3" + val sbtV = (pluginCrossBuild / sbtBinaryVersion).value + val scalaV = (update / scalaBinaryVersion).value + Defaults.sbtPluginExtra(dependency, sbtV, scalaV) + } +} else libraryDependencies ++= Seq[ModuleID]()