name: Check coding styles

on:
  pull_request:
    paths:
      - '**.js'
      - '**.php'
      - '**.module'
      - '**.profile'
      - '**.theme'
      - '**.install'

jobs:
  eslint:
    name: runner / eslint
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v1

      # pin to node 18.13 until npm v9 is supported by reviewdog eslint
      - uses: actions/setup-node@v3
        with:
          node-version: '18.13'

      - name: eslint
        uses: reviewdog/action-eslint@v1
        with:
          github_token: ${{ secrets.github_token }}
          reporter: github-pr-check

  phpcs:
    name: runner / phpcs
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v1

      - name: phpcs
        uses: chrfritsch/action-drupal-coder@master
        with:
          github_token: ${{ secrets.github_token }}
          level: error
          filter_mode: nofilter
