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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false
      - name: Set up pre-commit caching
        uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
        with:
          path: |
            ~/.cache/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
