https://github.com/maxnowack/local-cache
Github Action to provide caching data by placing a tarball on the local filesystem. Drop-in replacement for `actions/cache@v3`
https://github.com/maxnowack/local-cache
Last synced: about 2 months ago
JSON representation
Github Action to provide caching data by placing a tarball on the local filesystem. Drop-in replacement for `actions/cache@v3`
- Host: GitHub
- URL: https://github.com/maxnowack/local-cache
- Owner: maxnowack
- License: mit
- Created: 2023-04-19T08:29:02.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-05T07:42:42.000Z (about 2 years ago)
- Last Synced: 2025-07-03T17:51:53.355Z (11 months ago)
- Language: TypeScript
- Homepage:
- Size: 17.3 MB
- Stars: 58
- Watchers: 3
- Forks: 12
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# local-cache
GitHub Actions to provide caching data by placing a tarball on the local filesystem. The goal of this action is to speed up saving and restoring of the cache and remove the http overhead that occurs when using the `actions/cache` action.
This action is designed for use with runners that have persistent storage. Please only use this action with self-hosted runners that have a persistent volume. It will not work properly on GitHub hosted runners or runners with ephemeral storage, as the cache will be deleted upon job completion.
## Usage
The actions is designed as a drop-in replacement for `actions/cache@v3`. Take a look at their documentation. You can adapt the usage from their and use all of the features.
The created cache tarballs are placed in `$RUNNER_TOOL_CACHE/$GITHUB_REPOSITORY`.
`GITHUB_REPOSITORY` will be set to the name (`org/repo`) of the repository from where the action is executed.
`RUNNER_TOOL_CACHE` defaults to `/opt/hostedtoolcache`. This should point to a folder on a persistent storage.
### Example cache workflow
````yaml
name: Caching Primes
on: push
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Cache Primes
id: cache-primes
uses: maxnowack/local-cache@v2
with:
path: prime-numbers
key: ${{ runner.os }}-primes
- name: Generate Prime Numbers
if: steps.cache-primes.outputs.cache-hit != 'true'
run: /generate-primes.sh -d prime-numbers
- name: Use Prime Numbers
run: /primes.sh -d prime-numbers
````
## Contributing
Contributions to the project are welcome. Feel free to fork and improve. I do my best accept pull requests in a timely manor, especially when tests and updated docs are included.
## License
The code in this project is released under the [MIT License](LICENSE)