From fa2799adb40ad62e705e3aec59b9b5aaf79ff098 Mon Sep 17 00:00:00 2001 From: Scion Date: Thu, 12 Mar 2026 21:16:20 -0700 Subject: [PATCH] Added support of default registry. --- npm/npm-test/action.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/npm/npm-test/action.yaml b/npm/npm-test/action.yaml index adb1cb0..61705db 100644 --- a/npm/npm-test/action.yaml +++ b/npm/npm-test/action.yaml @@ -9,6 +9,10 @@ inputs: description: "Node.js version to use." required: false default: "20" + useDefaultRegistry: + description: "Whether to include https://registry.npmjs.org as a public (no-auth) registry. Values: true, false." + required: false + default: "true" registries: description: "Newline-separated list of registry URLs that require authentication." required: false @@ -61,7 +65,13 @@ runs: - name: "Configure npm authentication" if: ${{ inputs.registries && inputs.apiKeys }} run: | - bash "${{ github.action_path }}/configure-auth.sh" add "${{ inputs.registries }}" "${{ inputs.apiKeys }}" + REGISTRIES="${{ inputs.registries }}" + API_KEYS="${{ inputs.apiKeys }}" + if [ "${{ inputs.useDefaultRegistry }}" == "true" ]; then + REGISTRIES=$(printf '%s\n%s' 'https://registry.npmjs.org' "$REGISTRIES") + API_KEYS=$(printf '%s\n%s' 'none' "$API_KEYS") + fi + bash "${{ github.action_path }}/configure-auth.sh" add "$REGISTRIES" "$API_KEYS" working-directory: ${{ inputs.workingDirectory }} shell: bash - name: "Install dependencies"