mise-action/dist
Andrew Thauer cea720d8cd
fix: pass cwd to all exec calls in exportMiseEnv() (#390)
## Problem

The `exportMiseEnv()` function ignores the `working_directory` (and
`install_dir`) input when running `mise env --json`. It always executes
in the process default CWD — the GitHub Actions workspace root —
regardless of what directory was used for `mise install`.

This means if a caller sets `working_directory: path/to/subdir`, mise
resolves environment variables against the workspace root's `mise.toml`,
not the intended subdirectory's config.

### Impact

Since mise 2026.2.0, lockfiles are enabled by default. When `mise env
--json` runs without a `mise.lock` present (e.g. because the correct
`working_directory` was not used), mise attempts to resolve loose tool
versions (like `"latest"`) from the network. In environments with
private npm registries, this causes `npm view` calls that fail with 403
errors. Mise retries indefinitely, spawning 20+ orphaned npm processes
and eventually hitting `EAGAIN` (OS error 11), hanging CI permanently.

The other mise commands (`miseInstall`, `miseReshim`, etc.) already pass
`cwd` correctly via the shared `mise()` helper. Only `exportMiseEnv()`
was missing this.

## Fix

Resolve `working_directory` (falling back to `install_dir`, then
`process.cwd()`) at the top of `exportMiseEnv()` and pass `{ cwd }` to
all four `exec.getExecOutput` calls within the function:

- `mise env --redacted --json`
- `mise env --json`
- `mise env --dotenv` (redacted fallback)
- `mise env --dotenv` (legacy fallback)

## Related

- Issue #267: `working_directory` not respected for env export

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-03-06 10:12:44 -06:00
..
index.js fix: pass cwd to all exec calls in exportMiseEnv() (#390) 2026-03-06 10:12:44 -06:00
index.js.map fix: pass cwd to all exec calls in exportMiseEnv() (#390) 2026-03-06 10:12:44 -06:00
licenses.txt chore: release v3.4.0 (#291) 2025-10-31 10:43:55 -05:00
sourcemap-register.js feat: support windows (#122) 2024-09-25 21:27:52 +00:00