Remove pipes which can randomly fail apparently

* Previously `git log --oneline | grep -v 7a064ae | head -n 100` was throwing an
  error `grep: write error: Broken pipe` which as far as I can tell is working
  as intended and can't be fixed. So we remove pipes and use temporary files
  like animals.
This commit is contained in:
baldurk
2025-12-02 20:04:07 +00:00
parent 372aae1381
commit 7a2af108ad
+14 -6
View File
@@ -26,31 +26,39 @@ jobs:
- name: Check commit messages (PR)
if: ${{ github.event_name == 'pull_request' }}
run: |
git log --oneline | grep -v 7a064ae | head -n 100 > commits
git log --oneline > a
grep -v 7a064ae a > b
head -n 100 b > c
tail -n +2 c > commits
echo "Checking last 100 commits:"
cat commits
cut -d ' ' -f2- commits > commit_msgs
echo ==================
if cat commits | tail -n +2 | cut -d ' ' -f2- | grep -q '.\{73\}'; then
if grep -q '.\{73\}' commit_msgs; then
(echo -n "::error::";
echo "Some commit message summary lines are too long. See CONTRIBUTING.md for more information.";
echo "Invalid commits:";
echo;
cat commits | tail -n +2 | cut -d ' ' -f2- | grep '.\{73\}';) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
grep '.\{73\}' commit_msgs;) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
exit 1;
fi
- name: Check commit messages (Push)
if: ${{ github.event_name == 'push' }}
run: |
git log --oneline | grep -v 7a064ae | head -n 100 > commits
git log --oneline > a
grep -v 7a064ae a > b
head -n 100 b > c
cp c commits
echo "Checking last 100 commits:"
cat commits
cut -d ' ' -f2- commits > commit_msgs
echo ==================
if cat commits | cut -d ' ' -f2- | grep -q '.\{73\}'; then
if grep -q '.\{73\}' commit_msgs; then
(echo -n "::error::";
echo "Some commit message summary lines are too long. See CONTRIBUTING.md for more information.";
echo "Invalid commits:";
echo;
cat commits | cut -d ' ' -f2- | grep '.\{73\}';) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
grep -q '.\{73\}' commit_msgs;) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
exit 1;
fi
clang-format: