Skip to content

Commit

Permalink
Update content/actions/writing-workflows/choosing-what-your-workflow-…
Browse files Browse the repository at this point in the history
…does/caching-dependencies-to-speed-up-workflows.md

Co-authored-by: Ben Ahmady <[email protected]>
  • Loading branch information
nguyenalex836 and subatoi authored Nov 1, 2024
1 parent 879f66e commit d158a5f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ Users with `write` access to a repository can use the {% data variables.product.

Caches have branch scope restrictions in place, which means some caches have limited usage options. For more information on cache scope restrictions, see "[AUTOTITLE](/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache)." If caches limited to a specific branch are using a lot of storage quota, it may cause caches from the `default` branch to be created and deleted at a high frequency.

For example, a repository could have many new pull requests opened, each with their own caches that are restricted to that branch. These caches could take up the majority of the cache storage for that repository. {% data reusables.actions.cache-eviction-policy %} In order to prevent cache thrashing when this happens, you can set up workflows to delete caches on a faster cadence than the cache eviction policy will. You can use the `gh` CLI to delete caches for specific branches.
For example, a repository could have many new pull requests opened, each with their own caches that are restricted to that branch. These caches could take up the majority of the cache storage for that repository. {% data reusables.actions.cache-eviction-policy %} In order to prevent cache thrashing when this happens, you can set up workflows to delete caches on a faster cadence than the cache eviction policy will. You can use the {% data variables.product.prodname_cli %} to delete caches for specific branches.

The following example workflow uses [`gh cache`](https://cli.github.com/manual/gh_cache) to delete up to 100 caches created by a branch once a pull request is closed.

Expand Down

0 comments on commit d158a5f

Please sign in to comment.