Use `actions/cache` for custom cache paths.
Section: Caching dependencies
Cache arbitrary paths
yaml
yaml
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
.venv
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-Explanation
Choose keys that change when dependencies change, and use restore keys for partial hits.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Caching dependencies
Upload build output as an artifact
Save files from the workflow run for later download or later jobs.