Try to make CI check for commit messages more robust

* For some reason the commit message check failed to detect a bad message on a
  PR commit. The only clue is a 'broken pipe' message from tail in the log but
  it doesn't reproduce on another repository with the same scripts :(.
* Temporarily ignore the bad commit from future checks until it drops out of the
  most recent 100.
This commit is contained in:
baldurk
2025-11-27 14:08:07 +00:00
parent 7a064ae915
commit c61e3f72f0
+12 -4
View File
@@ -26,23 +26,31 @@ jobs:
- name: Check commit messages (PR)
if: ${{ github.event_name == 'pull_request' }}
run: |
if git log --oneline | tail -n +2 | head -n 100 | cut -d ' ' -f2- | grep -q '.\{73\}'; then
git log --oneline | grep -v 7a064ae | head -n 100 > commits
echo "Checking last 100 commits:"
cat commits
echo ==================
if cat commits | tail -n +2 | cut -d ' ' -f2- | grep -q '.\{73\}'; then
(echo -n "::error::";
echo "Some commit message summary lines are too long. See CONTRIBUTING.md for more information.";
echo "Invalid commits:";
echo;
git log --oneline | tail -n +2 | head -n 100 | cut -d ' ' -f2- | grep '.\{73\}';) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
cat commits | tail -n +2 | cut -d ' ' -f2- | grep '.\{73\}';) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
exit 1;
fi
- name: Check commit messages (Push)
if: ${{ github.event_name == 'push' }}
run: |
if git log --oneline | head -n 100 | cut -d ' ' -f2- | grep -q '.\{73\}'; then
git log --oneline | grep -v 7a064ae | head -n 100 > commits
echo "Checking last 100 commits:"
cat commits
echo ==================
if cat commits | cut -d ' ' -f2- | grep -q '.\{73\}'; then
(echo -n "::error::";
echo "Some commit message summary lines are too long. See CONTRIBUTING.md for more information.";
echo "Invalid commits:";
echo;
git log --oneline | head -n 100 | cut -d ' ' -f2- | grep '.\{73\}';) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
cat commits | cut -d ' ' -f2- | grep '.\{73\}';) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
exit 1;
fi
clang-format: