Skip to content

Commit 4447c90

Browse files
claudemldangelo
andcommitted
fix: use custom npm cache directory on Windows
Avoid corrupted system npm cache by using a temporary cache directory on Windows runners. This prevents ECOMPROMISED errors without needing to clean the cache. Co-Authored-By: Michael D'Angelo <michael@promptfoo.dev>
1 parent 454c05a commit 4447c90

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ jobs:
8686
- name: Install package
8787
run: uv sync
8888

89-
- name: Clear npm cache on Windows
89+
- name: Set custom npm cache directory on Windows
9090
if: runner.os == 'Windows'
91-
run: npm cache clean --force
92-
continue-on-error: true
91+
run: |
92+
echo "NPM_CONFIG_CACHE=${{ runner.temp }}\npm-cache" >> $GITHUB_ENV
93+
npm config set cache "${{ runner.temp }}\npm-cache" --global
94+
shell: bash
9395

9496
- name: Test CLI can be invoked
9597
uses: nick-fields/retry@v3

0 commit comments

Comments
 (0)