---
# https://github.com/redhat-plumbers-in-action/differential-shellcheck#readme

name: Differential ShellCheck
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

permissions:
  contents: read

jobs:
  lint:
    if: github.event.repository.name != 'systemd-security'
    runs-on: ubuntu-24.04

    permissions:
      security-events: write

    steps:
      - name: Repository checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 0
          persist-credentials: false

      - name: Differential ShellCheck
        uses: redhat-plumbers-in-action/differential-shellcheck@d965e66ec0b3b2f821f75c8eff9b12442d9a7d1e
        with:
          # exclude all `.in` files because they may contain unsupported syntax, and they have to be preprocessed first
          # TEMPORARY: exclude bash completion files, they would generate too many defects in Code scanning dashboard (600+)
          # exclude zsh completion files, zsh is not supported by ShellCheck
          exclude-path: |
            '**/*.in'
            'shell-completion/bash/*'
            'shell-completion/zsh/*'
          token: ${{ secrets.GITHUB_TOKEN }}
