]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
workflows: add signed-off check
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 29 Jun 2021 22:24:01 +0000 (00:24 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 29 Jun 2021 23:47:07 +0000 (01:47 +0200)
This adds a github workflow for checking the signed off line in commit
messages.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
.github/workflows/signed-off.yml [new file with mode: 0644]
tests/scripts/workflows/signed-off.sh [new file with mode: 0755]

diff --git a/.github/workflows/signed-off.yml b/.github/workflows/signed-off.yml
new file mode 100644 (file)
index 0000000..d88ea15
--- /dev/null
@@ -0,0 +1,10 @@
+name: signed-off
+on: [pull_request]
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+      - run: "${GITHUB_WORKSPACE}/tests/scripts/workflows/signed-off.sh"
\ No newline at end of file
diff --git a/tests/scripts/workflows/signed-off.sh b/tests/scripts/workflows/signed-off.sh
new file mode 100755 (executable)
index 0000000..4901fbc
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -x
+
+if [[ "$(git log --oneline --no-merges origin/"${GITHUB_BASE_REF}"..HEAD | wc -l)" -ne "$(git log --no-merges origin/"${GITHUB_BASE_REF}"..HEAD | grep -c Signed-off-by)" ]]; then
+  echo "One or more commits is/are missing a Signed-off-by. Add it with 'git commit -s'."
+  exit 1
+else
+  echo "Sign-off ok!"
+fi
\ No newline at end of file