Add check that all PR commits are formatted

* Checking compilation would be prohibitively expensive, but formatting can be
  feasibly checked.
This commit is contained in:
baldurk
2026-04-16 12:42:56 +01:00
parent ec64c18bb0
commit f9cc10399f
+19 -1
View File
@@ -69,7 +69,7 @@ jobs:
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 5
fetch-depth: 0
- name: Run clang-format
run: |
bash ./util/clang_format_all.sh
@@ -83,6 +83,24 @@ jobs:
git diff;) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
exit 1;
)
- name: Check commit messages (PR)
if: ${{ github.event_name == 'pull_request' }}
run: |
git log --oneline origin/${{github.base_ref}}.. > a
echo "Changing individual clang-format commits:"
cat a
awk '{print $1}' a > b
for COMMIT in $(cat b); do
git checkout $COMMIT
./util/clang_format_all.sh --head-commit
git diff --quiet || (
(echo -n "::error::";
echo "commit $COMMIT has clang-format issues. See CONTRIBUTING.md for more information.";
echo;
git diff;) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
exit 1;
)
done
cmake-minimum:
name: Baseline cmake check
needs: [commit-msg, clang-format]