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
Cache npm dependencies with setup-node
Use built-in npm cache support.
OpenIn sheetyamlsame section
Upload build output as an artifact
Save files from the workflow run for later download or later jobs.
Download a prior artifact
Fetch an artifact in a later job.
List workflows with GitHub CLI
Inspect workflows from the terminal.
Trigger a workflow manually with gh
Dispatch a workflow file from the CLI.
Watch a workflow run
Stream progress of the latest run in the terminal.