name: Update clang
runs:
  using: composite
  steps:
    - shell: bash
      run: |
        softwareupdate -l
        label=$((softwareupdate -l 2>/dev/null | grep 'Label:' | grep -o 'Command Line Tools for Xcode.*' | head -1) || echo '')
        if [ -n "$label" ]; then
          softwareupdate -i "$label"
          xcode_path=$(ls -1 '/Applications' | grep 'Xcode_.*\.app' | sort -r | head -1)
          sudo xcode-select -s "/Applications/$xcode_path"
        else
          echo "Not found."
        fi
        which clang
        clang -v
