name: Pull Request reviews
on:
  pull_request:
    branches: [main]

jobs:
  pre-commit:
    permissions:
      contents: read
    runs-on: ubuntu-24.04-arm
    env:
      SKIP: no-commit-to-branch
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Set up pre-commit caching
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        with:
          path: |
            $XDG_CACHE_HOME/pre-commit
          key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
          restore-keys: pre-commit-${{ runner.os }}-
      - name: Set up pre-commit
        run: |
          sudo apt-get update
          sudo apt-get install --yes --no-install-recommends \
            clang-format \
            git \
            meson \
            patch \
            pre-commit \
            shellcheck \
            shfmt
      - name: Run pre-commit hooks
        run: pre-commit run -v --show-diff-on-failure --hook-stage commit --all-files

  snap:
    needs: pre-commit
    uses: ./.github/workflows/snap.yml
    with:
      deploy: false
    secrets: inherit

  matrix:
    needs: pre-commit
    uses: ./.github/workflows/matrix.yml
    with:
      publish: false
    secrets: inherit
