Skip to content

Commit a0c0668

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

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/test_commitlist.yml

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

0 commit comments

Comments
 (0)