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
      run: |
        shopt -s globstar
        shopt -s nullglob
        clang-format-${{ inputs.version }} --dry-run --Werror **/*.cpp **/*.h **/*.m **/*.mm
