diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c0e183b..c7522a3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -298,6 +298,57 @@ jobs: fi shell: bash + test_dev_engines_on_fail_error: + name: 'Test devEngines.packageManager with onFail=error (${{ matrix.version }}, ${{ matrix.os }})' + # Regression test for #252: with devEngines.packageManager.onFail="error" and no + # `version:` input, the user's first `pnpm` call hit BAD_PM_VERSION because the + # bootstrap version didn't match. The action now exports + # pnpm_config_pm_on_fail=download so pnpm switches versions instead of erroring. + + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + version: + - '9.15.5' + - '>=9.15.0' + + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + + - name: Set up package.json with devEngines.packageManager onFail=error + run: echo '{"devEngines":{"packageManager":{"name":"pnpm","version":"${{ matrix.version }}","onFail":"error"}}}' > package.json + shell: bash + + - name: Run the action + uses: ./ + + - name: 'Test: version' + run: | + set -e + required='${{ matrix.version }}' + actual="$(pnpm --version)" + echo "pnpm version: ${actual}" + + if [ "${required}" = ">=9.15.0" ]; then + min="9.15.0" + if [ "$(printf '%s\n' "${min}" "${actual}" | sort -V | head -n1)" != "${min}" ]; then + echo "Expected pnpm version >= ${min}, but got ${actual}" + exit 1 + fi + else + if [ "${actual}" != "${required}" ]; then + echo "Expected pnpm version ${required}, but got ${actual}" + exit 1 + fi + fi + shell: bash + test_run_install: name: 'Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }})' diff --git a/dist/index.js b/dist/index.js index f7910dc..4164ba5 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/src/install-pnpm/run.ts b/src/install-pnpm/run.ts index 6b04107..b8c3e6f 100644 --- a/src/install-pnpm/run.ts +++ b/src/install-pnpm/run.ts @@ -67,6 +67,11 @@ export async function runSelfInstaller(inputs: Inputs): Promise