craigburke/client-dependencies-gradle

Downloading private npm package from GitHub Packages seems not to work

paksydavid opened this issue · 0 comments

Hi,

With the 1.4.1 version, I try to depend on a private npm package from GitHub Packages like so:

clientDependencies {
    githubUsername = System.getenv("GITHUB_ACTOR")
    githubPassword = System.getenv("GITHUB_TOKEN")
    githubToken = System.getenv("GITHUB_TOKEN")

    registry 'GitHubPackages', type:'npm', url:'https://npm.pkg.github.com/'

    GitHubPackages {
        '@myorganization/my-package'('0.0.4')
    }
}

I created a personal access token in GitHub with privileges (delete:packages, read:packages, repo, write:packages) and set it to environment variable GITHUB_TOKEN.
(I made sure that GITHUB_ACTOR and GITHUB_TOKEN are both set as environment variable and are available in the gradle script.)

When I execute clientInstall task, it fails with HTTP 401:

> Task :clientInstall FAILED
Task ':clientInstall' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Custom actions are attached to task ':clientInstall'.
:clientInstall (Thread[Daemon worker Thread 4,5,main]) completed. Took 1.182 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':clientInstall'.
> java.io.IOException: java.io.IOException: java.io.IOException: Server returned HTTP response code: 401 for URL: https://npm.pkg.github.com/@myorganization/my-package

...

Caused by: org.gradle.api.UncheckedIOException: java.io.IOException: java.io.IOException: java.io.IOException: Server returned HTTP response code: 401 for URL: https://npm.pkg.github.c
om/@myorganization/my-package

For me it seems that client-dependencies-gradle does not use githubUsername, githubPassword or githubToken.
Are these only used for Bower repositories or should these be used for npm repositories as well?

Any help would be greatly appreciated! :)