You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/test_branch_conventions.yml
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -72,14 +72,23 @@ jobs:
72
72
echo "✅ No fixup commits found in the PR branch."
73
73
fi
74
74
75
-
# require a ":" to appear somewhere in each commit message:
75
+
# require a well-formed subsystem tag before ":" in each commit message:
76
76
while IFS= read x; do
77
-
if ! [[ "$x" == *":"* ]] ; then
77
+
# strip leading hash from oneline format
78
+
subject="${x#* }"
79
+
# extract everything before the first colon
80
+
prefix="${subject%%:*}"
81
+
if [[ "$prefix" == "$subject" ]]; then
78
82
echo "❌ Commit message ($x) missing subsystem tag on front. Re-word your commit to reflect what subsystem it changes. E.g. 'AP_Compass: Added driver for XYZZY' (https://ardupilot.org/dev/docs/submitting-patches-back-to-master.html)"
79
83
exit 1
80
84
fi
85
+
# spaces and quotes are allowed to support Revert commits e.g. 'Revert "AP_Periph: ...'
86
+
if ! [[ "$prefix" =~ ^[A-Za-z0-9._/\ \"-]+$ ]]; then
87
+
echo "❌ Commit message ($x) has malformed subsystem tag '$prefix'. The subsystem prefix must contain only letters, digits, dots, underscores, slashes, hyphens, spaces, and quotes. E.g. 'AP_Compass: Added driver for XYZZY' (https://ardupilot.org/dev/docs/submitting-patches-back-to-master.html)"
88
+
exit 1
89
+
fi
81
90
done <<< $COMMITS
82
-
echo "✅ Commit messages have subsystem tags."
91
+
echo "✅ Commit messages have well-formed subsystem tags."
0 commit comments