Skip to content

Commit

Permalink
Section 9 added caching inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
moontrip committed Jul 28, 2024
1 parent d241ac4 commit 00417ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/actions/cached-deps/action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
name: 'Get & Cache Dependencies'
description: 'Get the dependencies (via npm) and cache them.'
# DKDK add inputs
inputs:
caching:
description: 'Whether to cache dependencies or not.'
required: false
default: 'true'
runs:
# DKDK custom composite action
using: 'composite'
steps:
- name: Cache dependencies
if: inputs.caching == 'true'
id: cache
uses: actions/cache@v4
with:
path: node_modules
key: deps-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
if: steps.cache.outputs.cache-hit != 'true' && inputs.caching != 'true'
run: npm ci
# DKDK shell: bash is required for custom composite action
shell: bash
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
- name: Load & cache dependencies
# DKDK no need to indicate file (action.yml)
uses: ./.github/actions/cached-deps
with:
caching: 'false'
- name: Lint code
run: npm run lint
test:
Expand Down

0 comments on commit 00417ea

Please sign in to comment.