fix: correct cache key precedence to match runtime behavior

The cache key was preferring environment input over process.env.MISE_ENV,
but setEnvVars() does the opposite (existing MISE_ENV takes precedence).
This caused a cache key/runtime mismatch when both were set.

Now both use the same precedence: process.env.MISE_ENV || environment input

This ensures the cache key always matches the actual MISE_ENV value that
will be used at runtime.

Also corrected CHANGELOG.md to remove inaccurate statement about env input.

Fixes precedence inversion identified by Greptile review.
This commit is contained in:
Jorge Rodriguez 2026-04-21 10:21:54 +02:00
parent 74e6914774
commit d6d59bb04f
No known key found for this signature in database
GPG key ID: A22D46F0D97D588A
4 changed files with 8 additions and 8 deletions

6
dist/index.js generated vendored
View file

@ -85189,10 +85189,10 @@ async function processCacheKeyTemplate(template) {
const version = getInput('version');
const installArgs = getInput('install_args');
const cacheKeyPrefix = getInput('cache_key_prefix') || 'mise-v1';
// Check environment input first, then fall back to process.env.MISE_ENV
// This ensures the cache key includes the environment even before setEnvVars() runs
// Match the precedence in setEnvVars(): process.env.MISE_ENV takes precedence over environment input
// This ensures the cache key matches the runtime MISE_ENV value
const environmentInput = getInput('environment');
const miseEnv = (environmentInput || process.env.MISE_ENV || '').replace(/,/g, '-');
const miseEnv = (process.env.MISE_ENV || environmentInput || '').replace(/,/g, '-');
const platform = await getTarget();
// Calculate file hash
const fileHash = await hashFiles(MISE_CONFIG_FILE_PATTERNS.join('\n'));

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long