name: Clang Format
inputs:
  directory:
    description: Directory to Lint
    required: true
  version:
    description: LLVM version to use # Should be kept roughly in sync with arcanist
    required: false
    default: 12

runs:
  using: "composite"
  steps:
    - name: Install
      shell: bash
      run: sudo apt-get install -y clang-format-${{ inputs.version }}

    - name: clang-format
      working-directory: ${{ inputs.directory }}
      shell: bash
      env:
        BASHOPTS: extglob:nullglob
      run: clang-format-${{ inputs.version }} --dry-run --Werror **/*.{h,hh,hpp,c,cpp,cc,m,mm}
