---
name: Lint

on: [push, pull_request]

jobs:
  check-syntax:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
    # check why is failing and change afterwards
    steps:
      - name: Checkout repo
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # ratchet:actions/checkout@v6

      - name: Lint Yaml
        uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # ratchet:ibiqlik/action-yamllint@v3
        with:
          format: github
          file_or_dir: tests/regression/tests
          config_file: .yamllint.yml

      - name: Linelint
        uses: fernandrone/linelint@7907a5dca0c28ea7dd05c6d8d8cacded713aca11 # ratchet:fernandrone/linelint@master
        id: linelint

      - name: Set up Python 3
        uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # ratchet:actions/setup-python@v6
        with:
          python-version: 3.9

      - name: "Check CRS syntax"
        run: |
          pip install --upgrade setuptools
          pip install secrules-parsing
          secrules-parser -c --output-type github -f rules/*.conf
