Skip to content

Commit 7a9a94c

Browse files
committed
feat: add tool-versions-file option to run-script
### what an a `tool-versions-file` parameter to the `run-script` workflow to allow selecting a different file from `.tool-versions` ### why Allow use CI-specific tooling without having `mise` pick them up by default in the repo ### testing will test in workflows ### docs updated docs
1 parent d5b3816 commit 7a9a94c

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎.github/workflows/run-script.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ on:
1818
type: boolean
1919
description: "Expose the job's read-only GitHub token to the script as GH_TOKEN"
2020
default: false
21+
tool-versions-file:
22+
type: string
23+
description: "Name of the mise tool versions file. A bare filename, looked up from the working directory up to the repository root"
24+
default: ".tool-versions"
2125
secrets:
2226
STEP_SECURITY_API_KEY:
2327
required: false
@@ -29,6 +33,7 @@ jobs:
2933
contents: read
3034
env:
3135
HARDEN_RUNNER: ${{ secrets.STEP_SECURITY_API_KEY != '' }} # zizmor: ignore[secrets-outside-env]
36+
MISE_DEFAULT_TOOL_VERSIONS_FILENAME: ${{ inputs.tool-versions-file }}
3237
steps:
3338
- name: Harden Runner
3439
if: env.HARDEN_RUNNER == 'true'
@@ -48,6 +53,8 @@ jobs:
4853
with:
4954
minimum_release_age: 7d
5055
cache: true
56+
# The default cache key only hashes .tool-versions, so add the custom file.
57+
cache_key: "{{cache_key_prefix}}-{{platform}}-{{file_hash}}-${{ hashFiles(format('**/{0}', inputs.tool-versions-file)) }}"
5158

5259
# Always read the cache, it's safe to do so even on untrusted PRs.
5360
- name: Restore pre-commit cache

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ commits never get one, so a SHA is what names the commit you meant.
3434

3535
Run a set of commands on the repository, with the required tools installed via `mise`.
3636

37+
Tools are read from `.tool-versions` by default. Set `tool-versions-file` to use a
38+
different file: it must be a bare filename (not a path), which mise looks up from the
39+
working directory up to the repository root.
40+
3741

3842
```
3943
Lint:

0 commit comments

Comments
 (0)