name: 'Install'
description: 'Prepares the repo for a job by checking out and installing dependencies'
inputs:
    node-version:
        description: 'The node version to setup'
        required: true
    registry-url:
        description: 'Define registry-url'
        required: false

runs:
    using: 'composite'
    steps:
        -   name: echo github.ref
            shell: bash
            run: echo ${{ github.ref }}

        -   name: Use Node.js ${{ inputs.node-version }}
            uses: actions/setup-node@v4
            with:
                node-version: ${{ inputs.node-version }}
                registry-url: ${{ inputs.registry-url }}

        -   name: Use cache
            uses: actions/cache@v4
            with:
                path: |
                    node_modules
                    */*/node_modules
                key: ${{ runner.os }}-install-${{ hashFiles('**/package.json') }}
                restore-keys: |
                    ${{ runner.os }}-install-

        -   name: Install
            shell: bash
            run: |
                npm ci
