Files
mailadler/.github/workflows/check-code-format.yml
georg0480 214ee0619e
Some checks are pending
check-code-format / clang-format (push) Waiting to run
trigger: re-run format check
Amp-Thread-ID: https://ampcode.com/threads/T-019c2688-afaf-76f5-b318-15265247ba46
Co-authored-by: Amp <amp@ampcode.com>
2026-02-04 17:00:31 +01:00

44 lines
1.1 KiB
YAML

name: check-code-format
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
push:
branches: [main, master]
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install clang-format
run: sudo apt-get install -y clang-format-14
- name: Check style
run: |
FILES=$(find ./src -type f \( -name "*.h" -o -name "*.c" -o -name "*.cpp" \) \
! -path "*/spatialmedia/*" \
! -name "defaultlayouts.h" \
! -path "*_autogen*")
if [ -z "$FILES" ]; then
echo "No source files found to check"
exit 0
fi
echo "Checking $(echo "$FILES" | wc -l) files..."
clang-format-14 --dry-run --Werror -style=file $FILES
if [ $? -eq 0 ]; then
echo "SUCCESS: All files are formatted correctly"
else
echo "FAILURE: Some files are formatted incorrectly"
echo "Run 'clang-format-14 -i <files>' locally to fix"
exit 1
fi
# Trigger CI