Skip to content

Commit

Permalink
Revised defaults to use environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
djspiewak committed Mar 3, 2020
1 parent e802d48 commit e64d8e9
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/main/scala/sbtghpackages/GitHubPackagesPlugin.scala
Expand Up @@ -20,7 +20,6 @@ import sbt._, Keys._

import scala.sys.process._
import scala.util.Try
import scala.util.control.NonFatal

object GitHubPackagesPlugin extends AutoPlugin {
@volatile
Expand All @@ -41,16 +40,10 @@ object GitHubPackagesPlugin extends AutoPlugin {

import autoImport._

val userDefaults = try {
val actor = "git config github.actor".!!.trim
Seq(githubActor := actor)
} catch {
case NonFatal(_) =>
Seq.empty
}
val userDefaults = sys.env.get("GITHUB_ACTOR").toSeq.map(githubActor := _)

val authenticationSettings = Seq(
githubTokenSource := TokenSource.GitConfig("github.token"),
githubTokenSource := TokenSource.Environment("GITHUB_TOKEN"),

credentials += {
val src = githubTokenSource.value
Expand Down Expand Up @@ -84,6 +77,8 @@ object GitHubPackagesPlugin extends AutoPlugin {
}
},

resolvers ++= githubOwner.?.value.toSeq.map(Resolver.githubPackages(_)),

scmInfo := {
for {
owner <- githubOwner.?.value
Expand Down

0 comments on commit e64d8e9

Please sign in to comment.