Can't publish to GitHub Package Registry

I am trying to publish from a github action to the github package registry but can’t get it to publish from the CI.

Here is the repo: https://github.com/hipstersmoothie/auto-gpr-test/runs/924412958?check_suite_focus=true

And here is the error keep getting

lerna ERR! E401 Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.


Things I’ve done:

  1. used “npm login” and successfully published locally
  2. copied my auth token into an env var, tried running build, same error

even simpler example (1 package) same result https://github.com/hipstersmoothie/auto-single-gpr/runs/924472488?check_suite_focus=true

I think I figured it out

My theory:

  • the setup node action sets up the npmrc auth
  • that took precedence over the npmrc auto sets up
  • publish fails because the NODE_AUTH_TOKEN required by the npmrc created by the setup action isn’t present

Hi @hipstersmoothie,

I’m glad you managed to figure it out!

You should find your yarn release step only requires NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}. The .npmrc file that uses this is created in the actions/setup-node@v1 action.

Looking at your workflow, I’m surprised you managed to make it work with Yarn without a .yarnrc file. Am I missing this being created somewhere?