ci(clang-format): add clang-format check workflow #2
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: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
clang-format-check: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code from the repository | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
# Step 2: Install clang-format 20.0.0 | |
- name: Install clang-format 20.0.0 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-format-20 | |
sudo ln -sf /usr/bin/clang-format-20 /usr/bin/clang-format | |
# Step 3: Run clang-format | |
- name: Run clang-format check | |
run: | | |
FILES_TO_CHECK=$(find . -name "*.c" -o -name "*.h") | |
clang-format -i $FILES_TO_CHECK --dry-run --Werror |