name: rules

on:
  workflow_run:
    workflows: ["master", "pr"]
    types:
      - completed

jobs:
  validate:
    runs-on: windows-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v4
    - name: Download MSI
      uses: dawidd6/action-download-artifact@v2
      with:
        run_id: ${{ github.event.workflow_run.id }}
        name: fibratus-amd64.msi
        path: .
        search_artifacts: true
    - name: Install Fibratus
      shell: bash
      run: |
        ./make.bat install
    - name: Validate rules
      shell: bash
      run: |
        export PATH="/c/Program Files/Fibratus/Bin:$PATH"
        fibratus rules list
        fibratus rules validate
