--- name: Wrapper for step-security/mise-action author: SonarSource Engineering XP description: | Wrapper for step-security/mise-action with S3-backed mise caching, pinned versions, and Repox authentication for mise backends. branding: color: green icon: package inputs: add_shims_to_path: description: "if false, will not add mise shims directory to PATH" required: false default: "true" bootstrap: description: "if true, will run `mise bootstrap` instead of `mise install`" required: false default: "false" bootstrap_args: description: "Additional arguments to pass to `mise bootstrap`." required: false bootstrap_skip: description: "Comma-separated bootstrap parts to skip, such as \"tools,task\". Passed as `mise bootstrap --skip`." required: false env: description: "Automatically load mise environment variables for subsequent steps." required: false default: "true" experimental: description: "if true, will use experimental features" required: false default: "false" export_path: description: "Add PATH entries produced by mise, including [env] _.path, to subsequent steps through GITHUB_PATH." required: false default: "true" fetch_from_github: description: "If true (default), fetch the mise binary from GitHub. If false and using the latest version, fetch from mise.jdx.dev instead." required: false default: "true" github_token: description: "GitHub token for API authentication to avoid rate limits when installing GitHub-hosted tools. Defaults to the automatic GitHub token. Used only during this action unless persist_github_token is set." required: false default: '${{ github.token }}' install: description: "if false, will not run `mise install` or `mise bootstrap`" required: false default: "true" install_args: description: "Arguments to pass to `mise install` such as \"bun\" to only install bun. When a repo mise lock file is present, the action automatically adds `--locked` unless you already provided it." required: false log_level: description: "The log level to use for the action" required: false default: "info" mise_env: description: "The mise environment(s) to use, such as \"ci\" or \"ci,linux\". The action exports it as MISE_ENV (overriding any existing value), so the cache key, `mise install`, and later steps in the job all load the same `mise..toml` configs." required: false mise_toml: description: "If present, this value will be written to the mise.toml file" required: false monorepo: description: "Automatically pass `--monorepo` to `mise install` when the mise configuration has `monorepo.config_roots`. Set to false to opt out." required: false default: "true" persist_github_token: description: "If true, export MISE_GITHUB_TOKEN to later steps of the job so they can call the GitHub API authenticated." required: false default: "true" plugins: description: "Plugins to install before tools, one per line as `name` or `name url`, e.g. `yarn` or `php https://github.com/verzly/mise-php#latest`. Useful for idiomatic version files (such as .yvmrc) that need a plugin." required: false default: "" reshim: description: "if true, will run `mise reshim --all` after setting up mise" required: false default: "false" sha256: description: "The SHA256 checksum of the mise binary to verify the download." required: false tool_versions: description: "If present, this value will be written to the .tool-versions file" required: false version: description: "The version of mise to install." required: false default: "2026.11.7" working_directory: description: "The directory that mise runs in" required: false cache: description: "Restore and save mise tools with the wrapper's S3 cache. false skips the cache; Vault and Repox are still configured." required: false default: "true" cache_key_prefix: description: "Prefix for the S3 cache key. Use different prefixes when multiple jobs install different tool sets." required: false default: "mise" artifactory_reader_role: description: "Suffix of the Artifactory reader role in Vault. Defaults to public-reader for public repositories and private-reader for private repositories." required: false default: "" repox_url: description: "URL for Repox." required: false default: "https://repox.jfrog.io" vault_url: description: "URL of Vault used to fetch Artifactory credentials." required: false default: "https://vault.sonar.build" auto_update: description: "Not supported by the wrapper: The wrapper pins the mise version." required: false cache_max_age_days: description: "Not supported by the wrapper: Upstream caching is always disabled." required: false cache_key: description: "Not supported by the wrapper: The wrapper builds its own S3 cache key; use cache_key_prefix." required: false cache_restore_retry_budget: description: "Not supported by the wrapper: Upstream caching is always disabled." required: false cache_save: description: "Not supported by the wrapper: The wrapper saves its S3 cache whenever cache is true; set cache to false to skip it." required: false cache_save_retry_budget: description: "Not supported by the wrapper: Upstream caching is always disabled." required: false cache_save_post: description: "Not supported by the wrapper: The wrapper saves its S3 cache in the post step whenever cache is true; set cache to false to skip it." required: false install_dir: description: "Not supported by the wrapper: Deprecated upstream." required: false minimum_release_age: description: "Not supported by the wrapper: The wrapper pins the mise version, so upstream ignores it." required: false mise_dir: description: "Not supported by the wrapper: The wrapper's cache relies on the default mise directory." required: false wings_enabled: description: "Not supported by the wrapper: Sends downloads through a third-party asset cache." required: false artifactory-reader-role: description: "Removed in 2.0.0; use artifactory_reader_role." required: false cache-key-prefix: description: "Removed in 2.0.0; use cache_key_prefix." required: false mise-toml: description: "Removed in 2.0.0; use mise_toml." required: false mise-version: description: "Removed in 2.0.0; use version." required: false repox-url: description: "Removed in 2.0.0; use repox_url." required: false vault-url: description: "Removed in 2.0.0; use vault_url." required: false outputs: cache-hit: description: true when the S3 cache was restored from an exact key match. value: ${{ steps.cache.outputs.cache-hit || 'false' }} versions: description: JSON object of the active, installed tool versions, keyed by tool name, as reported by step-security/mise-action. value: ${{ steps.mise.outputs.versions }} runs: using: composite steps: - name: Check inputs shell: bash env: IN_CACHE: ${{ inputs.cache }} IN_AUTO_UPDATE: ${{ inputs.auto_update }} IN_CACHE_KEY: ${{ inputs.cache_key }} IN_CACHE_MAX_AGE_DAYS: ${{ inputs.cache_max_age_days }} IN_CACHE_RESTORE_RETRY_BUDGET: ${{ inputs.cache_restore_retry_budget }} IN_CACHE_SAVE_RETRY_BUDGET: ${{ inputs.cache_save_retry_budget }} IN_CACHE_SAVE: ${{ inputs.cache_save }} IN_CACHE_SAVE_POST: ${{ inputs.cache_save_post }} IN_INSTALL_DIR: ${{ inputs.install_dir }} IN_MINIMUM_RELEASE_AGE: ${{ inputs.minimum_release_age }} IN_MISE_DIR: ${{ inputs.mise_dir }} IN_WINGS_ENABLED: ${{ inputs.wings_enabled }} IN_ARTIFACTORY_READER_ROLE: ${{ inputs.artifactory-reader-role }} IN_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }} IN_MISE_TOML: ${{ inputs.mise-toml }} IN_MISE_VERSION: ${{ inputs.mise-version }} IN_REPOX_URL: ${{ inputs.repox-url }} IN_VAULT_URL: ${{ inputs.vault-url }} run: | failed=0 reject() { if [[ -n "$2" ]]; then echo "::error title=mise-action-wrapper::Input $1 $3" failed=1 fi } if [[ "$IN_CACHE" != "true" && "$IN_CACHE" != "false" ]]; then echo "::error title=mise-action-wrapper::Input cache must be true or false, got '$IN_CACHE'." failed=1 fi reject auto_update "$IN_AUTO_UPDATE" "is not supported: the wrapper pins the mise version." reject cache_key "$IN_CACHE_KEY" "is not supported: the wrapper builds its own S3 cache key; use cache_key_prefix." reject cache_max_age_days "$IN_CACHE_MAX_AGE_DAYS" "is not supported: upstream caching is always disabled; the wrapper manages its own S3 cache." reject cache_restore_retry_budget "$IN_CACHE_RESTORE_RETRY_BUDGET" "is not supported: upstream caching is always disabled; the wrapper manages its own S3 cache." reject cache_save_retry_budget "$IN_CACHE_SAVE_RETRY_BUDGET" "is not supported: upstream caching is always disabled; the wrapper manages its own S3 cache." reject cache_save "$IN_CACHE_SAVE" "is not supported: the wrapper saves its S3 cache whenever cache is true; set cache to false to skip it." reject cache_save_post "$IN_CACHE_SAVE_POST" "is not supported: the wrapper saves its S3 cache in the post step whenever cache is true; set cache to false to skip it." reject install_dir "$IN_INSTALL_DIR" "is not supported: deprecated upstream." reject minimum_release_age "$IN_MINIMUM_RELEASE_AGE" "is not supported: the wrapper pins the mise version, so upstream ignores it." reject mise_dir "$IN_MISE_DIR" "is not supported: the wrapper's cache relies on the default mise directory." reject wings_enabled "$IN_WINGS_ENABLED" "is not supported: sends downloads through a third-party asset cache." reject artifactory-reader-role "$IN_ARTIFACTORY_READER_ROLE" "was renamed to artifactory_reader_role in 2.0.0." reject cache-key-prefix "$IN_CACHE_KEY_PREFIX" "was renamed to cache_key_prefix in 2.0.0." reject mise-toml "$IN_MISE_TOML" "was renamed to mise_toml in 2.0.0." reject mise-version "$IN_MISE_VERSION" "was renamed to version in 2.0.0." reject repox-url "$IN_REPOX_URL" "was renamed to repox_url in 2.0.0." reject vault-url "$IN_VAULT_URL" "was renamed to vault_url in 2.0.0." exit "$failed" - name: Set Artifactory reader role shell: bash env: INPUT_ROLE: ${{ inputs.artifactory_reader_role }} run: | if [[ -n "$INPUT_ROLE" ]]; then echo "ARTIFACTORY_READER_ROLE=$INPUT_ROLE" >> "$GITHUB_ENV" elif [[ "${{ github.event.repository.visibility }}" == "public" ]]; then echo "ARTIFACTORY_READER_ROLE=public-reader" >> "$GITHUB_ENV" else echo "ARTIFACTORY_READER_ROLE=private-reader" >> "$GITHUB_ENV" fi - name: Fetch Artifactory credentials id: secrets uses: SonarSource/vault-action-wrapper@v3 with: url: ${{ inputs.vault_url }} secrets: | development/artifactory/token/{REPO_OWNER_NAME_DASH}-${{ env.ARTIFACTORY_READER_ROLE }} username | ARTIFACTORY_USERNAME; development/artifactory/token/{REPO_OWNER_NAME_DASH}-${{ env.ARTIFACTORY_READER_ROLE }} access_token | ARTIFACTORY_ACCESS_TOKEN; - name: Configure Repox for mise shell: bash env: ARTIFACTORY_URL: ${{ format('{0}/artifactory', inputs.repox_url) }} ARTIFACTORY_USERNAME: ${{ fromJSON(steps.secrets.outputs.vault || '{}').ARTIFACTORY_USERNAME }} ARTIFACTORY_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault || '{}').ARTIFACTORY_ACCESS_TOKEN }} run: | echo "GITHUB_ACTION_PATH=$GITHUB_ACTION_PATH" echo "github.action_path=${{ github.action_path }}" # Use the env var, not github.action_path: interpolating the template # into bash source eats Windows backslashes (C:\a\_actions\... → # C:a_actions...). Slash-normalize is Git Bash convenience, not the fix. "${GITHUB_ACTION_PATH//\\//}/scripts/configure-repox-for-mise.sh" - name: Compute mise cache key id: mise-config if: inputs.cache == 'true' shell: bash env: RUNNER_ARCH: ${{ runner.arch }} RUNNER_OS: ${{ runner.os }} MISE_ENV_INPUT: ${{ inputs.mise_env }} MONOREPO_INPUT: ${{ inputs.monorepo }} MISE_TOML_INPUT: ${{ inputs.mise_toml }} TOOL_VERSIONS_INPUT: ${{ inputs.tool_versions }} WORKDIR: ${{ inputs.working_directory }} INSTALL_INPUTS: | ${{ inputs.install }} ${{ inputs.install_args }} ${{ inputs.plugins }} ${{ inputs.bootstrap }} ${{ inputs.bootstrap_skip }} ${{ inputs.bootstrap_args }} run: | cd "${WORKDIR:-.}" "${GITHUB_ACTION_PATH//\\//}/scripts/mise-cache-key.sh" >> "$GITHUB_OUTPUT" - name: Resolve mise data directory id: mise-dir shell: bash run: | # step-security/mise-action and mise.exe use %LOCALAPPDATA%\mise on Windows, not # ~/.local/share/mise. Export the same path so cache restore and # mise-action share one location. # Slash-normalize: this value is also gh-action_cache's path: input, # which is slash-sensitive on Windows. if [[ "${RUNNER_OS}" == "Windows" ]]; then dir="${LOCALAPPDATA//\\//}/mise" else dir="${HOME}/.local/share/mise" fi echo "dir=${dir}" >> "$GITHUB_OUTPUT" echo "MISE_DATA_DIR=${dir}" >> "$GITHUB_ENV" - name: Restore mise tools cache id: cache if: inputs.cache == 'true' uses: SonarSource/gh-action_cache@v1 with: path: ${{ steps.mise-dir.outputs.dir }} key: ${{ inputs.cache_key_prefix }}-v3-${{ steps.mise-config.outputs.platform }}-${{ inputs.version }}-${{ steps.mise-config.outputs.digest }} restore-keys: | ${{ inputs.cache_key_prefix }}-v3-${{ steps.mise-config.outputs.platform }}-${{ inputs.version }}- - name: Remove mise from restored shims if: inputs.cache == 'true' shell: bash env: MISE_DATA_DIR: ${{ steps.mise-dir.outputs.dir }} run: | "${GITHUB_ACTION_PATH//\\//}/scripts/clean-restored-shims.sh" - name: Install mise tools id: mise uses: step-security/mise-action@0b7e97d1c09b90582cd9b8298da4c13f6b273d5b # v5.3.0 with: cache: false add_shims_to_path: ${{ inputs.add_shims_to_path }} bootstrap: ${{ inputs.bootstrap }} bootstrap_args: ${{ inputs.bootstrap_args }} bootstrap_skip: ${{ inputs.bootstrap_skip }} env: ${{ inputs.env }} experimental: ${{ inputs.experimental }} export_path: ${{ inputs.export_path }} fetch_from_github: ${{ inputs.fetch_from_github }} github_token: ${{ inputs.github_token }} install: ${{ inputs.install }} install_args: ${{ inputs.install_args }} log_level: ${{ inputs.log_level }} mise_env: ${{ inputs.mise_env }} mise_toml: ${{ inputs.mise_toml }} monorepo: ${{ inputs.monorepo }} persist_github_token: ${{ inputs.persist_github_token }} plugins: ${{ inputs.plugins }} reshim: ${{ inputs.reshim }} sha256: ${{ inputs.sha256 }} tool_versions: ${{ inputs.tool_versions }} version: ${{ inputs.version }} working_directory: ${{ inputs.working_directory }}