Skip to content

Repository files navigation

Local Cache action

This action allows caching dependencies and build outputs to improve workflow execution time on self hosted machine. Artifacts are cached in the /home/ubuntu/.cache by default.

What's New

v2

  • Caches that have not been accessed over 7 days are cleaned up automatically at post action stage by clean-key.

See the v1 README.md for older updates.

Usage

Pre-requisites

Create a workflow .yml file in your repository's .github/workflows directory.

Inputs

ParameterRequired/OptionalDescriptionDefault
pathRequiredA directory to save and restore cache.-
keyRequiredAn explicit key for a cache.-
baseOptionalA base directory to save and restore cache./home/ubuntu/.cache
clean-keyOptionalIf set, caches that have not been accessed over 7 days are cleaned up automatically at post action stage by clean-key.-

Outputs

OutputDescription
cache-hitCache hit or not

Example cache workflow

Restoring and saving cache using a single action

name: Caching Primeson: pushjobs:
build:
runs-on: [self-hosted]steps:
- uses: actions/checkout@v3
- name: Cache dependenciesid: cacheuses: corca-ai/local-cache@v2with:
path: path/to/dependencieskey: ${{ hashFiles('**/lockfiles') }}
- name: Install dependenciesif: steps.cache.outputs.cache-hit != 'true'run: /install.sh
- name: Use dependenciesrun: /run.sh

Cache Limits

Cache limits are defined by the disk space of self-hosted runners. Caches that have not been accessed over 7 days can be cleaned up at post action stage by clean-key, but if you still run out of disk space, you need to manage runners by increasing disk capacity or removing cache on your own.

About

This action allows caching dependencies and build outputs to improve workflow execution time on self hosted machine.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages