Added registry support to npm test.
This commit is contained in:
@@ -9,6 +9,14 @@ inputs:
|
||||
description: "Node.js version to use."
|
||||
required: false
|
||||
default: "20"
|
||||
registries:
|
||||
description: "Newline-separated list of registry URLs that require authentication."
|
||||
required: false
|
||||
default: "${{ github.server_url }}/api/packages/${{ github.repository_owner }}/npm/index.json"
|
||||
apiKeys:
|
||||
description: "Newline-separated list of API keys corresponding to registries."
|
||||
required: false
|
||||
default: "${{ github.token }}"
|
||||
testCommand:
|
||||
description: "Command to run tests. Default: npm test"
|
||||
required: false
|
||||
@@ -50,6 +58,12 @@ runs:
|
||||
node-version: ${{ inputs.nodeVersion }}
|
||||
cache: npm
|
||||
cache-dependency-path: ${{ inputs.workingDirectory }}/package-lock.json
|
||||
- name: "Configure npm authentication"
|
||||
if: ${{ inputs.registries != '' && inputs.apiKeys != '' }}
|
||||
run: |
|
||||
bash "${{ github.action_path }}/configure-auth.sh" add "${{ inputs.registries }}" "${{ inputs.apiKeys }}"
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
shell: bash
|
||||
- name: "Install dependencies"
|
||||
run: npm ci
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
@@ -74,3 +88,9 @@ runs:
|
||||
path: ${{ inputs.workingDirectory }}/${{ inputs.coverageDirectory }}
|
||||
if-no-files-found: warn
|
||||
retention-days: ${{ inputs.retention-days }}
|
||||
- name: "Clean up npm authentication"
|
||||
if: always()
|
||||
run: |
|
||||
bash "${{ github.action_path }}/configure-auth.sh" remove
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
shell: bash
|
||||
|
||||
Reference in New Issue
Block a user