Skip to content

Commit ba11616

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

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/test_commitlist.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: test commit list
2+
3+
on: push
4+
5+
concurrency:
6+
group: ci-${{github.workflow}}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-22.04
12+
container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.3
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.event.pull_request.base.ref }}
17+
path: base_branch
18+
submodules: 'recursive'
19+
20+
- name: Check commitlist ${{ github.event.pull_request.base.ref }}..HEAD
21+
shell: bash
22+
run: |
23+
set -ex
24+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
25+
26+
# create file to inspect
27+
COMMITLIST=/tmp/commitlist.txt
28+
git log --format="%s" ${{ github.event.pull_request.base.ref }}..HEAD >$COMMITLIST
29+
30+
echo "Commit list:"
31+
cat $COMMITLIST
32+
33+
# fixup commits should never be merged:
34+
if grep -F 'fixup!' $COMMITLIST; then
35+
echo "Fixup commits found"
36+
exit 1
37+
fi
38+
39+
# No Merge commits to be merged:
40+
if grep 'Merge branch.*into' $COMMITLIST; then
41+
echo "Merge commits found"
42+
exit 1
43+
fi
44+
45+
# require a ":" to appear somewhere in the message:
46+
while IFS= read x; do
47+
if ! [[ "$x" == *":"* ]] ; then
48+
echo "Commit message ($x) missing subsystem tag on front"
49+
exit 1
50+
fi
51+
done < $COMMITLIST

0 commit comments

Comments
 (0)