I have to download a package from my-org with GitHub actions for Node projects.
I have an action like this to make an .npmrc file:
> ${{ inputs.npmrc_path }}
echo "@my-org:registry=https://npm.pkg.github.com/" >> ${{ inputs.npmrc_path }}
if [ ! -z "${{ inputs.github_token }}" ]; then
echo "//npm.pkg.github.com/:_authToken=${{ inputs.github_token }}" >> ${{ inputs.npmrc_path }}
echo "@my-org:always-auth=true" >> ${{ inputs.npmrc_path }}
fi
echo "registry=https://registry.npmjs.org" >> ${{ inputs.npmrc_path }}
if [ ! -z "${{ inputs.nexus_url }}" ]; then
auth=$(echo -n '${{ inputs.nexus_user }}:${{ inputs.nexus_password }}' | base64)
echo "${{ inputs.nexus_url }}:_auth=$auth" >> ${{ inputs.npmrc_path }}
echo "always-auth=true" >> ${{ inputs.npmrc_path }}
fi
when it’s called by another action, token with all permissions is provided, I have admin permissions in that package and the repo which is calling the action has access to the package, but it gives me the following failure:
npm error code E401
npm error 401 Unauthorized - GET https://npm.pkg.github.com/@my-org%2fpackage - authentication token not provided
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/...log
package.json has this:
"dependencies": {
...
"@my-org/package": "0.0.6"
},
"devDependencies": {
...
},
"engines": {
"node": "6.17.0"
}
}
In local I can download.