Repository navigation
Commit 46452da
feat: add an optional uv cache to run-script and fix its pre-commit cache
### what
- Add a `uv-cache` input (default false) that restores uv's cache on every
run, falling back to the newest one when `uv.lock` moved, and prunes it
with `uv cache prune --ci` and saves it off pull requests.
- Key the pre-commit cache on the mise config and lockfiles and the selected
`mise-env` as well as `.pre-commit-config.yaml`.
- Export `PREK_HOME` from `$HOME` in the script instead of setting it in the
step's `env:`.
### why
Hook environments are built with the toolchains mise installs, so a Python
bump restored environments built against the old interpreter. `PREK_HOME`
was the literal string `~/.cache/pre-commit`, since `env:` values don't
expand `~`, so prek wrote its environments to a `~` directory in the
checkout and the cache step saved an empty one.
### testing
actionlint, zizmor, ruff and codespell pass (`prek run --all-files`). This
repository's CI uses `pre-commit-cache`, so it exercises the new key and
`PREK_HOME`.
### docs
The README's `run-script` section describes both caches.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent f9275f2 commit 46452da
2 files changed
Lines changed: 47 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
95 | 104 | | |
96 | 105 | | |
97 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
98 | 119 | | |
99 | 120 | | |
100 | 121 | | |
101 | 122 | | |
102 | 123 | | |
103 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
104 | 128 | | |
105 | 129 | | |
106 | 130 | | |
107 | | - | |
108 | | - | |
109 | 131 | | |
110 | | - | |
111 | | - | |
112 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
113 | 135 | | |
114 | 136 | | |
115 | 137 | | |
116 | 138 | | |
117 | 139 | | |
118 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| |||
0 commit comments