name: Lint

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

permissions: read-all

jobs:
  clang-format:

    runs-on: ubuntu-24.04

    steps:
    - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

    - name: Install dependencies
      run: |
        sudo apt update
        sudo apt -y install clang-format

    - name: Lint
      run: |
        find . -type f | grep -P ".*\.(c|cpp|h|hpp)\b" | xargs clang-format -style=file --dry-run -Werror
