我正在使用 GitHub 操作體驗 CI。
我在每個 CI 上安裝依賴項時遇到問題,發現我可以使用actions/cache.
這是我的部分 action.yaml
- name: Cache npm dependency
uses: actions/cache@v3
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- if: steps.npm-cache.outputs.cache-hit != true
name: Install Dependency
run: |
echo 'npm cache missed'
npm ci
并逐步恢復快取Cache npm dependency。
Cache restored successfully
Cache restored from key: Linux-npm-...
但它總是在“安裝依賴項”步驟中重新安裝依賴項。
Run echo 'npm cache missed'
echo 'npm cache missed'
npm ci
shell: /usr/bin/bash -e {0}
npm cache missed
> [email protected] ...
> node bin/postinstall || exit 0
added 661 packages in 19.862s
結果,快取變得毫無意義。我錯過了什么或做錯了什么?
uj5u.com熱心網友回復:
我通過像這樣修改它來解決它:!= true->!= 'true'
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/497139.html
