Skip to content

Commit c205dbd

Browse files
authored
ci(mise): make mise cache configurable via GitHub variable (#310)
## Description This PR makes the mise-action cache configuration centrally manageable through a GitHub repository variable (`MISE_CACHE_ENABLED`). ## Changes Made - Updated all `jdx/mise-action@v3` invocations in `.github/workflows/code_checks.yml` and `.github/workflows/publish_docs.yml` to use `cache: ${{ vars.MISE_CACHE_ENABLED || 'true'}}` instead of hardcoded values - Affected jobs: `pre-commit`, `python-checks`, `mkdocs`, `integration-tests`, `python-versions`, `push-docs` - The expression uses a fallback to `'true'` if the variable is not set, ensuring caching is enabled by default ## Reason for Changes Previously, the `cache` parameter was inconsistently set across different jobs (some had `false`, others had `true`). This makes it difficult to manage caching behavior across the entire workflow. By centralizing the cache configuration through a GitHub variable, we can: - Toggle caching on/off for all jobs from a single location (repository settings) - Maintain consistent caching behavior across all jobs - Quickly disable caching for troubleshooting without modifying workflow files - Keep caching enabled by default (when the variable is not set) ## Link to the initial request/ticket N/A - This is a workflow improvement.
1 parent fd9e5d4 commit c205dbd

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.github/workflows/code_checks.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ env:
2727
UV_PYTHON_PREFERENCE: only-managed
2828
UV_CACHE_DIR: /tmp/.uv-cache
2929
MISE_INSTALL_FROM_GITHUB: 1
30+
# The following repository variables control mise-action caching across jobs:
31+
# - MISE_CACHE_ENABLED: set to 'false' to disable mise action caching; defaults to 'true' when unset
32+
# - MISE_CACHE_KEY_PREFIX: prefix used for cache keys so different workflows can share/segregate caches
3033

3134
jobs:
3235
pre-commit:
@@ -43,7 +46,8 @@ jobs:
4346
- uses: jdx/mise-action@v3
4447
with:
4548
install: true
46-
cache: false
49+
cache: ${{ vars.MISE_CACHE_ENABLED || 'true'}}
50+
cache_key_prefix: ${{ vars.MISE_CACHE_KEY_PREFIX || 'mise-v0'}}
4751
version: ${{ vars.MISE_VERSION }}
4852

4953
- name: Restore uv cache
@@ -110,7 +114,8 @@ jobs:
110114
- uses: jdx/mise-action@v3
111115
with:
112116
install: true
113-
cache: true
117+
cache: ${{ vars.MISE_CACHE_ENABLED || 'true'}}
118+
cache_key_prefix: ${{ vars.MISE_CACHE_KEY_PREFIX || 'mise-v0'}}
114119
version: ${{ vars.MISE_VERSION }}
115120

116121
- name: Restore uv cache
@@ -205,7 +210,8 @@ jobs:
205210
- uses: jdx/mise-action@v3
206211
with:
207212
install: true
208-
cache: true
213+
cache: ${{ vars.MISE_CACHE_ENABLED || 'true'}}
214+
cache_key_prefix: ${{ vars.MISE_CACHE_KEY_PREFIX || 'mise-v0'}}
209215
version: ${{ vars.MISE_VERSION }}
210216
mise_toml: |
211217
[tools]
@@ -244,7 +250,8 @@ jobs:
244250
- uses: jdx/mise-action@v3
245251
with:
246252
install: true
247-
cache: true
253+
cache: ${{ vars.MISE_CACHE_ENABLED || 'true'}}
254+
cache_key_prefix: ${{ vars.MISE_CACHE_KEY_PREFIX || 'mise-v0'}}
248255
version: ${{ vars.MISE_VERSION }}
249256
mise_toml: |
250257
[tools]
@@ -282,7 +289,8 @@ jobs:
282289
- uses: jdx/mise-action@v3
283290
with:
284291
install: true
285-
cache: true
292+
cache: ${{ vars.MISE_CACHE_ENABLED || 'true'}}
293+
cache_key_prefix: ${{ vars.MISE_CACHE_KEY_PREFIX || 'mise-v0'}}
286294
version: ${{ vars.MISE_VERSION }}
287295
mise_toml: |
288296
[tools]

.github/workflows/publish_docs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ env:
2121
UV_PYTHON_PREFERENCE: only-managed
2222
UV_CACHE_DIR: /tmp/.uv-cache
2323
MISE_INSTALL_FROM_GITHUB: 1
24+
# The following repository variables control mise-action caching across jobs:
25+
# - MISE_CACHE_ENABLED: set to 'false' to disable mise action caching; defaults to 'true' when unset
26+
# - MISE_CACHE_KEY_PREFIX: prefix used for cache keys so different workflows can share/segregate caches
2427

2528
permissions:
2629
contents: write
@@ -39,7 +42,8 @@ jobs:
3942
- uses: jdx/mise-action@v3
4043
with:
4144
install: true
42-
cache: true
45+
cache: ${{ vars.MISE_CACHE_ENABLED || 'true'}}
46+
cache_key_prefix: ${{ vars.MISE_CACHE_KEY_PREFIX || 'mise-v0'}}
4347
version: ${{ vars.MISE_VERSION }}
4448

4549
- name: Configure Git Credentials

0 commit comments

Comments
 (0)