Skip to content

update

update #2

name: Clang Format Check
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install clang-format
run: sudo apt-get install clang-format -y
- name: Run clang-format
run: |
find . -name '*.cpp' -o -name '*.hpp' -o -name '*.h' | xargs clang-format -i
git diff --exit-code
- name: Check for unformatted code
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Code is not formatted. Please run clang-format."
exit 1
fi