Skip to content

Commit

Permalink
Created composite action for workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
shashi2504 authored Jan 11, 2025
1 parent 44bf0fc commit 255bcfe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
18 changes: 18 additions & 0 deletions .github/custom-actions/npm-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Npm Actions'
description: 'Used for installing and caching the dependencies'
inputs:
path:
description: 'Enter the path to cache'
required: true
runs:
using: 'composite'
steps:
- name: Caching Dependencies
uses: actions/cache@v3
with:
path: ${{ inputs.path }}
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}

- name: Installing Dependencies
run: npm install
shell: bash
15 changes: 3 additions & 12 deletions .github/workflows/solar-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ jobs:
with:
node-version: ${{ matrix.nodejs-versions }}

- name: Cache Dependencies # Added new Dependencies
uses: actions/cache@v3 # Updated Version
- name: Cache and Install npm packages
uses: ./.github/custom-actions/npm-action
with:
path: node_modules
key: ${{ runner.os }}--node_modules-${{ hashFiles('package-lock.json') }}

- name: Install Dependencies
run: npm install

- name: Unit Testing
id: nodejs-unit-testing
Expand Down Expand Up @@ -86,14 +82,9 @@ jobs:
# node-version: 18

- name: Cache Dependencies
uses: actions/cache@v3
uses: ./.github/custom-actions/npm-action
with:
path: node_modules
key: ${{ runner.os }}--node_modules-${{ hashFiles('package-lock.json') }} # Added Cache


- name: Install Dependencies
run: npm install

- name: Code Coverage
continue-on-error: true
Expand Down

0 comments on commit 255bcfe

Please sign in to comment.