I'm trying to set up a GitHub Actions workflow that will run the tests for a project when a PR is created. Here's the YAML for the action; it's pretty straight forward really.
steps:
- uses: actions/checkout@v1
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://www.myget.org/F/hsa/npm/
scope: '@hsa'
env:
NODE_AUTH_TOKEN: ${{ secrets.MYGET_TOKEN }}
- name: set always auth
run: |
npm config set always-auth true
- name: Install
run: |
npm install
- name: Run lint
shell: bash
run: |
if [[ $GITHUB_BASE_REF ]]
then
export NX_BASE=remotes/origin/$GITHUB_BASE_REF
else
export NX_BASE=$(git rev-parse HEAD~1)
fi
echo "Base => $NX_BASE"
npm run affected:test -- --base=$NX_BASE
The "Use Node.js" step sets the registry URL for the @hsa scope; the MYGET_TOKEN is set using secrets for the repo. The "set always auth" step was necessary because it wasn't done automatically. This seems like it should be enough to allow the action to install the private packages, but it doesn't work. This is the error I get on the "Install" step:
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="MyGet - hsa"
I've output the temporary .npmrc file that's created in the Action, and it does look correct, setting the registry for the given scope, so everything should work. But I can't get past the NPM Install step to actually run the tests.
Any help on what I'm missing for the authentication would be greatly appreciated. Thanks!
From https://github.com/actions/setup-node/
Try to use the npm install inside of the actions/setup-node.