Update clang-format-check.yml #111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Clang-Format Check | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
check-format: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- uses: actions/checkout@v3 | |
# Step 2: Install clang-format | |
- name: Install clang-format | |
run: sudo apt-get update && sudo apt-get install -y clang-format | |
- name: Check clang-format version | |
run: clang-format --version | |
# Step 3: Check formatting | |
- name: Run clang-format | |
run: | | |
# Find all .cpp and .hpp files | |
find . -name '*.cpp' -o -name '*.hpp' > files_to_check.txt | |
# Check if clang-format would make changes | |
clang-format --dry-run -Werror $(cat files_to_check.txt) |