Skip to content

Commit 47cd396

Browse files
committed
.github: add workflow to check commit history
1 parent fcbeb63 commit 47cd396

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/test_size.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,32 @@ jobs:
325325
else
326326
echo "No differences found." >> $GITHUB_STEP_SUMMARY
327327
fi
328+
329+
- name: Check commitlist ${{ github.event.pull_request.base.ref }}..HEAD
330+
shell: bash
331+
run: |
332+
set -ex
333+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
334+
335+
# create file to inspect
336+
git log --format="%s" ${{ github.event.pull_request.base.ref }}..HEAD >/tmp/commitlist.txt
337+
338+
# fixup commits should never be merged:
339+
if grep -F 'fixup!' /tmp/commitlist; then
340+
echo "Fixup commits found"
341+
exit 1
342+
fi
343+
344+
# No Merge commits to be merged:
345+
if grep 'Merge branch.*into' /tmp/commitlist; then
346+
echo "Merge commits found"
347+
exit 1
348+
fi
349+
350+
# require a ":" to appear somewhere in the message:
351+
while IFS= read x; do
352+
if ! [[ "$x" == *":"* ]] ; then
353+
echo "Commit message ($x) missing subsystem tag on front"
354+
exit 1
355+
fi
356+
done < /tmp/commitlist

0 commit comments

Comments
 (0)