Skip to content

run_install continues after a failed install command #235

Description

@lyzno1

Summary

When run_install is configured with multiple install targets, a failed pnpm install does not stop the remaining install commands. The action records the failure with core.setFailed(...), but then continues the loop and runs later run_install entries.

Example

- uses: pnpm/action-setup@v6
  with:
    version: 10
    run_install: |
      - cwd: packages/app
      - cwd: packages/lib

If the install in packages/app fails, the install in packages/lib still runs.

Current behavior

In src/pnpm-install/index.ts, both failure branches call setFailed(...) and then continue:

if (error) {
  setFailed(error)
  continue
}

if (status) {
  setFailed(`Command ${cmdStr} (cwd: ${options.cwd}) exits with status ${status}`)
  continue
}

@actions/core.setFailed(...) only sets process.exitCode and emits an error annotation. It does not throw or stop execution, so later install commands still run.

Expected behavior

The action should stop after the first failed install command unless there is an explicit input that says otherwise.

This action currently does not expose a continue-on-install-error or similar option, so users have no documented reason to expect fail-late behavior for run_install. For setup/install steps, fail-fast is usually safer because later installs can create extra side effects and make CI logs harder to diagnose.

Suggested fix

Replace the local setFailed(...) calls in runPnpmInstall with thrown errors, and let the top-level main().catch(...) mark the action as failed. For example:

if (error) {
  throw error
}

if (status) {
  throw new Error(`Command ${cmdStr} (cwd: ${options.cwd}) exits with status ${status}`)
}

Historical context

I checked git blame: this behavior was introduced in 1790ca7 (Add pnpm install) when the install runner was first added. I could not find documentation, tests, or commit messages indicating that continuing after a failed install was intended public behavior. The README documents that an array form executes multiple install commands, but it does not document continuing after one of them fails.

I can send a PR for this if the maintainers agree with the fail-fast behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions