Skip to content

Commit 7a2af10

Browse files
committed
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.
1 parent 372aae1 commit 7a2af10

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,39 @@ jobs:
2626
- name: Check commit messages (PR)
2727
if: ${{ github.event_name == 'pull_request' }}
2828
run: |
29-
git log --oneline | grep -v 7a064ae | head -n 100 > commits
29+
git log --oneline > a
30+
grep -v 7a064ae a > b
31+
head -n 100 b > c
32+
tail -n +2 c > commits
3033
echo "Checking last 100 commits:"
3134
cat commits
35+
cut -d ' ' -f2- commits > commit_msgs
3236
echo ==================
33-
if cat commits | tail -n +2 | cut -d ' ' -f2- | grep -q '.\{73\}'; then
37+
if grep -q '.\{73\}' commit_msgs; then
3438
(echo -n "::error::";
3539
echo "Some commit message summary lines are too long. See CONTRIBUTING.md for more information.";
3640
echo "Invalid commits:";
3741
echo;
38-
cat commits | tail -n +2 | cut -d ' ' -f2- | grep '.\{73\}';) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
42+
grep '.\{73\}' commit_msgs;) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
3943
exit 1;
4044
fi
4145
- name: Check commit messages (Push)
4246
if: ${{ github.event_name == 'push' }}
4347
run: |
44-
git log --oneline | grep -v 7a064ae | head -n 100 > commits
48+
git log --oneline > a
49+
grep -v 7a064ae a > b
50+
head -n 100 b > c
51+
cp c commits
4552
echo "Checking last 100 commits:"
4653
cat commits
54+
cut -d ' ' -f2- commits > commit_msgs
4755
echo ==================
48-
if cat commits | cut -d ' ' -f2- | grep -q '.\{73\}'; then
56+
if grep -q '.\{73\}' commit_msgs; then
4957
(echo -n "::error::";
5058
echo "Some commit message summary lines are too long. See CONTRIBUTING.md for more information.";
5159
echo "Invalid commits:";
5260
echo;
53-
cat commits | cut -d ' ' -f2- | grep '.\{73\}';) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
61+
grep -q '.\{73\}' commit_msgs;) | tr '\n' '\001' | sed -e 's#\x01#%0A#g';
5462
exit 1;
5563
fi
5664
clang-format:

0 commit comments

Comments
 (0)