mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-14 13:50:33 +00:00
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:
parent
74e6914774
commit
d6d59bb04f
4 changed files with 8 additions and 8 deletions
|
|
@ -9,7 +9,7 @@
|
|||
- Simplifies multi-environment workflows by eliminating manual export step
|
||||
- Respects existing MISE_ENV environment variable (takes precedence)
|
||||
- Automatically included in cache key generation via {{mise_env}} template variable
|
||||
- Only exports to GITHUB_ENV when `env` input is true (default)
|
||||
- Exports to GITHUB_ENV making it available to all subsequent workflow steps
|
||||
|
||||
---
|
||||
## [4.0.1](https://github.com/jdx/mise-action/compare/v4.0.0..v4.0.1) - 2026-03-22
|
||||
|
|
|
|||
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
|
|
@ -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
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -456,10 +456,10 @@ async function processCacheKeyTemplate(template: string): Promise<string> {
|
|||
const version = core.getInput('version')
|
||||
const installArgs = core.getInput('install_args')
|
||||
const cacheKeyPrefix = core.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 = core.getInput('environment')
|
||||
const miseEnv = (environmentInput || process.env.MISE_ENV || '').replace(
|
||||
const miseEnv = (process.env.MISE_ENV || environmentInput || '').replace(
|
||||
/,/g,
|
||||
'-'
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue