name: v4.x pull requests

on:
  pull_request_target:
    types:
    - opened
    - edited
    - synchronize
    branches:
    - v4.x

jobs:
  prlint:
    name: Validate PR title
    runs-on: ubuntu-latest
    steps:
    - uses: amannn/action-semantic-pull-request@v4
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  debug:
    name: Debug
    runs-on: ubuntu-latest
    steps:
    - uses: hmarr/debug-action@v2

  install:
    name: Install
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Cache node_modules
      id: cacheModules
      uses: actions/cache@v3
      with:
        path: ~/.npm # this is cache where npm installs from before going out to the network
        key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
    - name: Install dependencies
      if: steps.cacheModules.outputs.cache-hit != 'true'
      run: npm install

  checks:
    name: Checks
    needs: [install]
    uses: ./.github/workflows/checks.yml
