Skip to content

Commit

Permalink
feat(17-custom-actions): add first version of composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
lauromueller committed Nov 20, 2023
1 parent ab1a015 commit 5ac92db
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/actions/composite-cache-deps/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Cache Node and NPM Dependencies
description: This action allows to cache both Node and NPM dependencies based on the package-lock.json file.

inputs:
node-version:
description: NodeJS version to use
default: 20.x
required: true
working-dir:
description: The working directory of the application
default: .
required: false

runs:
using: composite
steps:
- name: Setup NodeJS version ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: ${{ inputs.working-dir }}/node_modules
key: node-modules-${{ hashFiles('${{ inputs.working-dir }}/package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
shell: bash
working-directory: ${{ inputs.working-dir }}

0 comments on commit 5ac92db

Please sign in to comment.