Skip to content

Commit 272219f

Browse files
committed
.github: add workflow to check commit history
1 parent fcbeb63 commit 272219f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/test_size.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,36 @@ 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+
COMMITLIST=/tmp/commitlist.txt
337+
git log --format="%s" ${{ github.event.pull_request.base.ref }}..HEAD >$COMMITLIST
338+
339+
echo "Commit list:"
340+
cat $COMMITLIST
341+
342+
# fixup commits should never be merged:
343+
if grep -F 'fixup!' $COMMITLIST; then
344+
echo "Fixup commits found"
345+
exit 1
346+
fi
347+
348+
# No Merge commits to be merged:
349+
if grep 'Merge branch.*into' $COMMITLIST; then
350+
echo "Merge commits found"
351+
exit 1
352+
fi
353+
354+
# require a ":" to appear somewhere in the message:
355+
while IFS= read x; do
356+
if ! [[ "$x" == *":"* ]] ; then
357+
echo "Commit message ($x) missing subsystem tag on front"
358+
exit 1
359+
fi
360+
done < $COMMITLIST

0 commit comments

Comments
 (0)