Open xsyro opened 4 years ago
Are you using IntelliJ?
Yes.
I think you're being afflicted by #24 then.
I have the same issue, but unable to fix with the work-around. I have tried multiple variations of below in my build.sbt
file with no luck:
publishMavenStyle := true
githubOwner := "andrewresearch"
githubRepository := "core"
githubTokenSource := TokenSource.GitConfig("github.token") || TokenSource.Environment("GITHUB_TOKEN")
credentials +=
Credentials(
"GitHub Package Registry",
"https://maven.pkg.github.com",
"andrewresearch",
sys.env.getOrElse("GITHUB_TOKEN", "N/A")
)
I find that the plugin seems to have a hard-coded bias for the GITHUB_TOKEN
environment variable. If the TokenSource
is chained to offer additional options, it will consider those - as long as the environment does have a set value of GITHUB_TOKEN
. Nevertheless, if GITHUB_TOKEN
is unset (forced to be absent), then the observed error [error] (credentials) unable to locate a valid GitHub token from Environment(GITHUB_TOKEN)
is reported.
We seek a tactic that offers a proper OR to handle the case where some build systems do not set environment variables.
We discover that this tactic does work with simpler SBT build.sbt files but it is not working with a more complex one that includes multiple built products (whatever sbt calls the intermediate builds).
Hi, does anyone know how to solve this error?
This is inside my ~/.sbt/1.0/github.sbt setting file.
The fact that you "redded" out the TokenSource.Environment
makes me think that you put the token itself in there.
IIUC it would rather be
TokenSource.Environment("SOME_ENVIRONMENT_VARIABLE_IN_WHICH_YOU_STORE_THE_TOKEN")
and then in your ~/.bashrc
or somewhere else you would have
SOME_ENVIRONMENT_VARIABLE_IN_WHICH_YOU_STORE_THE_TOKEN=the_token_itself
It works. Thank you for your help!
sbt:random-quotes> run [error] stack trace is suppressed; run last credentials for the full output [error] (credentials) unable to locate a valid GitHub token from Environment(GITHUB_TOKEN) [error] Total time: 0 s, completed 24 Nov 2022, 13:18:42 sbt:random-quotes> last credentials [error] java.lang.RuntimeException: unable to locate a valid GitHub token from Environment(GITHUB_TOKEN) [error] at scala.sys.package$.error(package.scala:30) [error] at sbtghpackages.GitHubPackagesPlugin$.$anonfun$authenticationSettings$2(GitHubPackagesPlugin.scala:53) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:49) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) [error] at sbt.std.Transform$$anon$4.work(Transform.scala:68) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23) [error] at sbt.Execute.work(Execute.scala:291) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64) [error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [error] at java.base/java.lang.Thread.run(Thread.java:829) [error] (credentials) unable to locate a valid GitHub token from Environment(GITHUB_TOKEN)
i ca't understand why it can't locate my github_token.
my ~/.sbt/1.0/github.sbt
credentials += Credentials( "GitHub Package Registry", "maven.pkg.github.com", "vazand", "ghp_mygithub_token_that_has_repo_and_write_permissions")
here I attached my project link please share your comments. @ductridev how did you solved the error? @nightscape I've tried put the token in ~/.bashrc and it did not work..! :(
@vazand not sure what's wrong then. I've started switching over to Mill, let's see if the grass is greener on the other side 😉
Hey @vazand, pls export GITHUB_TOKEN first in before sbt run
:
export GITHUB_TOKEN=<YOUR_GITHUB_TOKEN>
okay I'll check.
Hi @vazand are you able to fix the issues?
I am getting the below error -
[info] Wrote /home/knoldus/workstation/knoldus_aws_lib/kinesis-service/target/scala-2.13/kinesis-service_2.13-1.0.pom
[error] java.io.IOException: PUT operation to URL https://maven.pkg.github.com/piyushknoldus/knoldus_aws_lib/knoldus/kinesis-service_2.13/1.0/kinesis-service_2.13-1.0.pom failed with status code 404: Not Found; Response Body: The expected resource was not found.
my build.sbt setting -
githubOwner := "piyushknoldus"
githubRepository := "knoldus_aws_lib"
githubTokenSource := TokenSource.GitConfig("github.token") || TokenSource.Environment("GITHUB_TOKEN")
credentials +=
Credentials(
"GitHub Package Registry",
"https://maven.pkg.github.com",
"piyushknoldus",
sys.env.getOrElse("GITHUB_TOKEN", "N/A")
)
ThisBuild / publishTo := {
val nexus = "https://maven.pkg.github.com/"
Some("releases" at nexus + "piyushknoldus/knoldus_aws_lib")
}
I attempt to use sbt-github-package for firs time for my project. I attempt to import apply the plugin in my
plugins.sbt
fileaddSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.2")
However, this result to the errors belowError while importing sbt project: [info] welcome to sbt 1.3.12 (Oracle Corporation Java 1.8.0_102) [info] loading settings for project amadeus-sabre-mutli-gds-build from plugins.sbt ... [info] loading project definition from /Users/brakket/projects/travel-sdk-api/open-source/amadeus-sabre-mutli-gds/project [info] loading settings for project root from build.sbt ... [info] loading settings for project flight from build.sbt ... [info] loading settings for project common from build.sbt ... [info] set current project to amadeus-sabre-multi-gds (in build file:/Users/brakket/projects/travel-sdk-api/open-source/amadeus-sabre-mutli-gds/) [info] sbt server started at local:///Users/brakket/.sbt/1.0/server/f624faec50c66cc67b35/sock sbt:amadeus-sabre-multi-gds> [info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile, shellPrompt [info] The new values will be used by no settings or tasks. [info] Reapplying settings... [info] set current project to amadeus-sabre-multi-gds (in build file:/Users/brakket/projects/travel-sdk-api/open-source/amadeus-sabre-mutli-gds/) [info] Applying State transformations org.jetbrains.sbt.CreateTasks from /Users/brakket/Library/Application Support/IntelliJIdea2018.2/Scala/launcher/sbt-structure-1.0.jar [info] Reapplying settings... [info] set current project to amadeus-sabre-multi-gds (in build file:/Users/brakket/projects/travel-sdk-api/open-source/amadeus-sabre-mutli-gds/) [warn] undefined keys
githubOwner
andgithubRepository
[warn] retaining pre-existing publication settings [error] stack trace is suppressed; run 'last common / credentials' for the full output [error] stack trace is suppressed; run 'last credentials' for the full output [error] stack trace is suppressed; run 'last flight / credentials' for the full output [error] stack trace is suppressed; run 'last ssExtractDependencies' for the full output [error] stack trace is suppressed; run 'last flight / ssExtractDependencies' for the full output [error] stack trace is suppressed; run 'last common / ssExtractDependencies' for the full output [error] (common / credentials) unable to locate a valid GitHub token from Environment(GITHUB_TOKEN) [error] (credentials) unable to locate a valid GitHub token from Environment(GITHUB_TOKEN) [error] (flight / credentials) unable to locate a valid GitHub token from Environment(GITHUB_TOKEN)[error] (ssExtractDependencies) unable to locate a valid GitHub token from Environment(GITHUB_TOKEN) [error] (flight / ssExtractDependencies) unable to locate a valid GitHub token from Environment(GITHUB_TOKEN) [error] (common / ssExtractDependencies) unable to locate a valid GitHub token from Environment(GITHUB_TOKEN) [error] Total time: 0 s, completed Jun 29, 2020 1:14:06 AM [info] shutting down sbt server
I have stored the GITHUB_TOKEN in my environment variable. However, this's still result to failure.
I'll appreciate all efforts to resolving this issue.