Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build opt-out for cache-node-modules action #1070

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions actions/cache-node-modules/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ inputs:
build:
description: 'Extra commands to run if nothing is cached'
required: false
default: 'echo'
build_on_cache_fail:
description: 'Whether you want to run `npm run --if-present build` if there is no cache
require: false
default: 'true' # defaulting to true to not break any existing users.
achingbrain marked this conversation as resolved.
Show resolved Hide resolved
cache_name:
description: 'Cache name'
required: false
Expand All @@ -31,8 +36,11 @@ runs:
${{ inputs.directories }}
key: ${{ runner.os }}-build-${{ inputs.cache_name }}-${{ github.sha }}
- if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install
npm run --if-present build
${{ inputs.build }}
run: npm install
shell: bash
- if: steps.cache.outputs.cache-hit != 'true' && ${{ inputs.build_on_cache_fail }} == 'true'
run: npm run --if-present build
shell: bash
- if: steps.cache.outputs.cache-hit != 'true' && ${{ inputs.build }} != 'echo'
run: ${{ inputs.build }}
shell: bash