https://github.com/mangs/super-cache-action
Simple GitHub Action that improves cache performance over actions/cache's recommendations for Node.js projects
https://github.com/mangs/super-cache-action
cache github github-action performance simple
Last synced: 6 months ago
JSON representation
Simple GitHub Action that improves cache performance over actions/cache's recommendations for Node.js projects
- Host: GitHub
- URL: https://github.com/mangs/super-cache-action
- Owner: mangs
- License: mit
- Created: 2022-03-27T20:16:56.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T22:02:21.000Z (about 2 years ago)
- Last Synced: 2024-10-13T00:05:29.792Z (over 1 year ago)
- Topics: cache, github, github-action, performance, simple
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# `mangs/super-cache-action`
Simple GitHub Action that improves cache performance over `actions/cache`'s recommendations for Node.js projects
## Simple Example
```yaml
- uses: actions/setup-node@v3
- uses: mangs/super-cache-action@v3
id: super-cache
- if: steps.super-cache.outputs.cache-hit != 'true'
run: npm ci
```
## Custom Cache Key Example
```yaml
# ...
# Job 1: production deploy using a matrix strategy
- uses: actions/setup-node@v3
- uses: mangs/super-cache-action@v3
id: super-cache
with:
cache-key-suffix: production-deploy
- if: steps.super-cache.outputs.cache-hit != 'true'
run: npm ci --production
# ...
# ...
# Job 2: linting and unit testing using a matrix strategy
- uses: actions/setup-node@v3
- uses: mangs/super-cache-action@v3
id: super-cache
with:
cache-key-suffix: linting-and-unit-tests
- if: steps.super-cache.outputs.cache-hit != 'true'
run: npm ci
# ...
```
## Multiline Dependencies Example
```yaml
- uses: actions/setup-node@v3
- uses: mangs/super-cache-action@v3
id: super-cache
with:
cache-targets: |
./.eslintcache
./node_modules
- if: steps.super-cache.outputs.cache-hit != 'true'
run: npm ci
```
## Action Inputs
| Name | Required | Default Value | Descripition |
| ------------------ | -------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `cache-key-suffix` | N | `` | String appended to the end of the auto-generated cache key that allows for cache key customization (e.g. separate development and production caches with the latter using `npm ci --production`) |
| `cache-targets` | N | `./node_modules` | Single- or multi-line string wherein each line targets a resource to cache; can use globs |
| `package-manager` | N | `npm` | Package manager target for caching operations |
## Action Outputs
| Name | Descripition |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `cache-hit` | A string containing either `true` or `false` indicating if `cache-targets` were fetched from cache and applied to the current workflow run |