diff --git a/action.yml b/action.yml index 2b7d4334..e69cb3db 100644 --- a/action.yml +++ b/action.yml @@ -90,14 +90,23 @@ runs: run: | if [[ "${{runner.os}}" == "Linux" ]]; then sudo apt-get update - sudo apt-get install clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }} || true + # First try installing from default Ubuntu repositories before trying LLVM script + if ! sudo apt-get install clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }}; then + # This LLVM script will add the relevant LLVM PPA: https://apt.llvm.org/ + wget https://apt.llvm.org/llvm.sh -O $GITHUB_ACTION_PATH/llvm_install.sh + chmod +x $GITHUB_ACTION_PATH/llvm_install.sh + if sudo $GITHUB_ACTION_PATH/llvm_install.sh ${{ inputs.version }}; then + sudo apt-get install clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }} + fi + fi fi - if [[ "${{runner.os}}" == "macOS" ]];then + if [[ "${{runner.os}}" == "macOS" ]]; then python3 -m venv '${{ github.action_path }}/venv' source '${{ github.action_path }}/venv/bin/activate' fi python3 -m pip install -r '${{ github.action_path }}/requirements.txt' clang-tools -i ${{ inputs.version }} -b + - name: Run cpp-linter id: cpp-linter shell: bash