name: Check audit setting

on:
  push:
    branches: [ "*" ]
  workflow_dispatch:

jobs:
  build:
    strategy:
      matrix:
        os: [windows-latest, windows-2022, windows-2025]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Check PowerShell version(PowerShell core)
        run: |
          $PSVersionTable.PSVersion
        shell: pwsh

      - name: Run WELA.ps1 audit-settings(PowerShell core)
        run: |
          ./WELA.ps1 audit-settings -Baseline YamatoSecurity
        shell: pwsh

      - name: Run WELA.ps1 audit-filesize(PowerShell core)
        run: |
          ./WELA.ps1 audit-filesize -Baseline YamatoSecurity
        shell: pwsh

      - name: Output UsableRules.csv(PowerShell core)
        run: |
          Get-Content UsableRules.csv
        shell: pwsh

      - name: Output UnUsableRules.csv(PowerShell core)
        run: |
          Get-Content UnusableRules.csv
        shell: pwsh

      - name: Check PowerShell version(PowerShell 5.1)
        run: |
          $PSVersionTable.PSVersion
        shell: powershell

      - name: Run congiure command(PowerShell 5.1)
        run: |
          ./WELA.ps1 configure -Baseline YamatoSecurity -Auto
        shell: powershell

      - name: Run WELA.ps1 audit-settings(PowerShell 5.1)
        run: |
          ./WELA.ps1 audit-settings -Baseline YamatoSecurity
        shell: powershell

      - name: Run WELA.ps1 audit-filesize(PowerShell 5.1)
        run: |
          ./WELA.ps1 audit-filesize -Baseline YamatoSecurity
        shell: powershell

      - name: Output UsableRules.csv(PowerShell 5.1)
        run: |
          Get-Content UsableRules.csv
        shell: powershell

      - name: Output UnUsableRules.csv(PowerShell 5.1)
        run: |
          Get-Content UnusableRules.csv
        shell: powershell
