name: Yarn install on: workflow_call: secrets: node_version: required: true jobs: setup: name: Yarn install & cache runs-on: ubuntu-latest concurrency: group: yarn-install-${{ github.sha }} timeout-minutes: 10 steps: - name: Checkout uses: actions/checkout@v3 - uses: actions/setup-node@v3 name: Set nodeJs version with: node-version: ${{ secrets.NODE_VERSION }} # node_module cache helps to avoid 1 minute copying from yarn cache on every job run - name: node_modules cache id: node-modules-cache uses: actions/cache@v3 env: cache-name: node-modules-yarn cache-key: ${{ secrets.NODE_VERSION }}-${{ hashFiles('yarn.lock') }} with: path: node_modules key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-key }} restore-keys: ${{ runner.os }}-${{ env.cache-name }}- - name: Yarn install if: steps.node-modules-cache.outputs.cache-hit != 'true' run: yarn install --prefer-offline --frozen-lockfile