Skip to content

ci: ignore rule gitlint and add PR template #34

ci: ignore rule gitlint and add PR template

ci: ignore rule gitlint and add PR template #34

Workflow file for this run

# yamllint disable rule:line-length
---
name: Clang-Format
on: # yamllint disable-line rule:truthy
pull_request:
branches: ['*']
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get changed files
uses: jitterbit/get-changed-files@v1
id: changed_files
with:
format: space-delimited
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up clang-format
run: sudo apt-get install clang-format
- name: Run clang-format
run: |-
IFS=' ' read -r -a files <<< "${{ steps.changed_files.outputs.all }}"
cpp_files=()
for file in "${files[@]}"; do
if [[ "$file" == *.cpp || "$file" == *.h || "$file" == *.hpp || "$file" == *.cc || "$file" == *.cxx || "$file" == *.hxx ]]; then
cpp_files+=("$file")
fi
done
if [ ${#cpp_files[@]} -gt 0 ]; then
echo -e "Running clang-format"
clang-format --dry-run --Werror "${cpp_files[@]}"
else
echo -e "Skipping clang-format since no source files were changed."
fi
- name: Show failure message
if: failure()
run: |-
echo -e "To automatically apply suggested fixes, run the following command:
======================================================================================
1. Install clang-format:
sudo apt-get install clang-format
2. Run clang-format:
find . -name \"*.cpp\" -o -name \"*.h\" -o -name \"*.hpp\" -o -name \"*.cc\" -o -name \"*.cxx\" -o -name \"*.hxx\" | xargs clang-format -i
======================================================================================"