Add formatting check workflow for PRs

This commit is contained in:
rtm516 2026-03-26 13:24:42 +00:00 committed by GitHub
parent dee559bd16
commit acbffc59f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

30
.github/workflows/clang-format vendored Normal file
View file

@ -0,0 +1,30 @@
name: Check formatting
on: pull_request
permissions:
contents: read
pull-requests: write
jobs:
format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: reviewdog/action-setup@v1
- name: Check formatting on changed lines
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git clang-format --diff origin/${{ github.base_ref }}...HEAD -- \
'*.c' '*.cpp' '*.cc' '*.h' '*.hpp' \
| reviewdog \
-name="clang-format" \
-f=diff \
-reporter=github-pr-review \
-fail-level=error \
-filter-mode=added