Docs

Cache security

A pull request, above all one from a fork, can’t put what it likes in front of every later job.

Dependency caching

Every later job of a repository restores what a job saved, so the rules for saving are strict. A job saves dependency caches only when all of these are true:

  • The job succeeded. A failed job may have stopped halfway through filling a folder.
  • The run came from a push, schedule or workflow_dispatch.
  • It ran on the repository’s default branch.
  • The code is from the repository itself, not a fork.

We ask GitHub how the job ended before deciding. See Dependency caching.

actions/cache

A job reads the cache of its own branch, then the default branch’s, and saves to its own branch. A pull request never saves into the default branch’s cache. Runs set off by pull_request_target, issue_comment or a fork’s workflow_run can be started by anyone, so they read the default branch’s cache and save nothing there.

Disks

A job’s disks are kept only by a job that succeeded in a push, schedule or manual run on the default branch. Pull requests start from a disk but never change it. See Disks.

One repository at a time

A job can read the cache of its own repository only. Admins can delete entries, folders and disks from the Caching page at any time.