Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

mangs/super-cache-action

Simple GitHub Action that improves cache performance over actions/cache's recommendations for Node.js projects

Simple Example

- uses: actions/setup-node@v3
- uses: mangs/super-cache-action@v3id: super-cache
- if: steps.super-cache.outputs.cache-hit != 'true'run: npm ci

Custom Cache Key Example

# ...# Job 1: production deploy using a matrix strategy
- uses: actions/setup-node@v3
- uses: mangs/super-cache-action@v3id: super-cachewith:
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@v3id: super-cachewith:
cache-key-suffix: linting-and-unit-tests
- if: steps.super-cache.outputs.cache-hit != 'true'run: npm ci# ...

Multiline Dependencies Example

- uses: actions/setup-node@v3
- uses: mangs/super-cache-action@v3id: super-cachewith:
cache-targets: | ./.eslintcache ./node_modules- if: steps.super-cache.outputs.cache-hit != 'true'run: npm ci

Action Inputs

NameRequiredDefault ValueDescripition
cache-key-suffixN<empty-string>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-targetsN./node_modulesSingle- or multi-line string wherein each line targets a resource to cache; can use globs
package-managerNnpmPackage manager target for caching operations

Action Outputs

NameDescripition
cache-hitA string containing either true or false indicating if cache-targets were fetched from cache and applied to the current workflow run

About

Simple GitHub Action that improves cache performance over actions/cache's recommendations for Node.js projects

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors