Unable to find credentials for [GitHub Package Registry @ maven.pkg.github.com]
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 199
- Forks
- 67
- Avg merge
- 6h 24m
- Merged PRs (30d)
- 3
Description
Hi, first of all thanks for making this amazing project!
I am trying to use it to publish on github packages using github actions. But facing the following error.
Error:
[info] Main Scala API documentation successful.
[error] Unable to find credentials for [GitHub Package Registry @ maven.pkg.github.com].
[info] Main Scala API documentation successful.
[error] Unable to find credentials for [GitHub Package Registry @ maven.pkg.github.com].
[error] java.io.IOException: Server returned HTTP response code: 401 for URL: https://maven.pkg.github.com/tusharmath/zio-compose/zio-compose/zio-compose_2.13/0.1.0-SNAPSHOT/zio-compose_2.13-0.1.0-SNAPSHOT.pom
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[error] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[error] at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1974)
[error] at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1969)
[error] at java.base/java.security.AccessController.doPrivileged(Native Method)
[error] at java.base/sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1968)
[error] at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1536)
[error] at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
[error] at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:[25](https://github.com/tusharmath/zio-compose/runs/7834200470?check_suite_focus=true#step:7:26)0)
[error] at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:[28](https://github.com/tusharmath/zio-compose/runs/7834200470?check_suite_focus=true#step:7:29)8)
[error] at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82)
[error] at org.apache.ivy.util.FileUtil.copy(FileUtil.java:150)
Complete logs are available here.
build.sbt
import Dependencies._
Global / scalaVersion := "2.13.8"
val libVersion = "0.1.0-SNAPSHOT"
def publishSettings(projectName: String) = Seq(
publish / skip := false,
version := libVersion,
name := projectName,
versionScheme := Some("early-semver"),
publishTo := Some("Github Package Registry" at s"https://maven.pkg.github.com/tusharmath/${projectName}"),
)
// Projects
lazy val root = (project in file("."))
.aggregate(zioCompose, zioComposeMacros)
.settings(
publish / skip := true,
)
lazy val zioCompose = project
.in(file("./compose"))
.settings(publishSettings("zio-compose"))
.settings(
fork := true,
libraryDependencies := Seq(
ZIOCore,
ZIOSchema,
ZIOSchemaJson,
ZIOSchemaDerivation,
ZIOTest,
ZIOTestSbt,
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
)
.dependsOn(zioComposeMacros)
lazy val zioComposeMacros = project
.in(file("./compose-macros"))
.settings(publishSettings("zio-compose-macros"))
.settings(
fork := true,
libraryDependencies := Seq(
ZIOSchema,
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
),
)
// Flags
Global / semanticdbEnabled := true
Global / onChangedBuildSource := ReloadOnSourceChanges
Global / scalacOptions := Seq(
"-Ywarn-unused:imports",
"-Werror",
"-feature",
"-language:reflectiveCalls",
)
Things that I have tried
- Checked if the token has permissions, and it does.
Update 1
Updating the publishSettings method to the following worked
def publishSettings(projectName: String) = Seq(
publish / skip := false,
name := projectName,
versionScheme := Some("early-semver"),
publishTo := Some("GitHub Package Registry" at s"https://maven.pkg.github.com/tusharmath/zio-compose"),
credentials += Credentials("GitHub Package Registry", "maven.pkg.github.com", "tusharmath", sys.env("GITHUB_TOKEN")),
organization := "io.github.tusharmath",
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the build.sbt publishSettings method and compare the failing configuration with the working update in the issue. Check how credentials are resolved for the GitHub Package Registry during the GitHub Actions publish run. Done means the configured publish task finds the credentials and uploads the package without the 401 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, scala
- Domain
- build-system, ci-cd, release
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100