aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/check-signoff')
-rwxr-xr-xscripts/check-signoff39+39 −0
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/check-signoff b/scripts/check-signoff
new file mode 100755
--- /dev/null
+++ b/scripts/check-signoff
@@ -0,0 +1,39 @@
+#!/bin/sh -eu
+# SPDX-FileCopyrightText: 2026 Nikolay Govorov
+# SPDX-License-Identifier: Apache-2.0
+
+ALLOWLIST='Nikolay Govorov|github-actions\[bot\]'
+
+bad=0
+for sha in $(git log --no-merges --format=%H); do
+ author=$(git log -1 --format='%an' "$sha")
+ if printf '%s\n' "$author" | grep -qE "^($ALLOWLIST)$"; then
+ continue
+ fi
+
+ email=$(git log -1 --format='%ae' "$sha")
+ expected="${author} <${email}>"
+ if ! git log -1 --format='%(trailers:key=Signed-off-by,valueonly)' "$sha" | grep -qF "$expected"; then
+ echo "Commit $(printf '%.8s' "$sha") by ${expected} is missing a valid Signed-off-by"
+ bad=1
+ fi
+done
+
+if [ "$bad" -eq 1 ]; then
+ echo "All commits must be signed off (git commit -s). See CLA.md"
+ exit 1
+fi
+
+# Check that all authors and committers are in .mailmap
+missing=0
+for email in $(git log --no-merges --format='%ae%n%ce' | sort -u); do
+ if ! grep -v '^#' .mailmap | grep -qF "<${email}>"; then
+ echo "Email <${email}> is not in .mailmap"
+ missing=1
+ fi
+done
+
+if [ "$missing" -eq 1 ]; then
+ echo "All contributors must be listed in .mailmap. See README.md"
+ exit 1
+fi