---
name: 🐶 SHELL check 🧪
on:
  workflow_dispatch:
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  reviewdog:
    permissions:
      checks: write
      contents: read
      pull-requests: write
    name: shellcheck
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: haya14busa/action-cond@v1
        id: reporter
        with:
          cond: ${{ github.event_name == 'pull_request' }}

      - uses: reviewdog/action-shellcheck@v1
        with:
          reporter: ${{ steps.reporter.outputs.value }}
          github_token: ${{ secrets.github_token }}
          path: |
            "."
            modules
          exclude: "./programs/*"
          check_all_files_with_shebangs: true
          level: error
          shellcheck_flags: '--external-sources --severity=error'
