I have a project on GitHub that has several dependencies all of which are published on GitHub Package Registry.
I use GitHub actions to publish my packages. I am able to use GitHub secrets in my workflow.yml
file but not so in my .npmrc
file.
As there is no way for a CI environment to know the value stored in a secret if I used it in my .npmrc
file as _authToken={GPR_TOKEN}
, I am curious if there is a workaround since my current implementation is to use my Personal Access Token(PAT) literally in my npmrc.
I have used ${GITHUB_TOKEN}
successfully but it fails during my CI job because {GITHUB_TOKEN}
is only scoped for the repository the workflow is running from and cannot be used to install dependencies.
I also tried using _authToken={MY_PAT_SECRET}
in the .npmrc
file but my CI job fails. The only thing that has worked so far is pasting my PAT in .npmrc
but I don't want to do it.
Any ideas or workarounds about how to use GitHub secrets in a .npmrc file?