Added registry support to npm test.

This commit is contained in:
2026-01-05 09:44:19 -08:00
parent e0af4ec969
commit d1a57aef46
2 changed files with 62 additions and 0 deletions

View File

@@ -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