From 6f217c945e3418ef3fe6240344737d8816759676 Mon Sep 17 00:00:00 2001
From: Awiteb
Date: Sun, 14 Jul 2024 03:39:41 +0300
Subject: [PATCH] feat: Create DCO CI checker
Signed-off-by: Awiteb
---
.forgejo/workflows/dco_checker.yml | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 .forgejo/workflows/dco_checker.yml
diff --git a/.forgejo/workflows/dco_checker.yml b/.forgejo/workflows/dco_checker.yml
new file mode 100644
index 0000000..9196cab
--- /dev/null
+++ b/.forgejo/workflows/dco_checker.yml
@@ -0,0 +1,29 @@
+name: DCO checker
+
+on:
+ pull_request:
+ branches: [master]
+ types: [opened, synchronize, reopened]
+
+jobs:
+ check:
+ name: DCO checker
+ runs-on: debian
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: DCO checker
+ run: |
+ commits=$(git rev-list origin/master..HEAD)
+ for commit in $commits; do
+ commit_subject=$(git show --quiet --format=%s $commit)
+ commit_sha=$(echo $commit | cut -c1-10)
+ echo "Checking commit $commit_sha \"$commit_subject\""
+ if ! git show --quiet --format=%B $commit | grep -q "Signed-off-by:"; then
+ author=$(git show --quiet --format=%an $commit)
+ echo "Commit $commit by $author is missing the 'Signed-off-by:' line"
+ exit 1
+ fi
+ done
+ echo "All commits have the 'Signed-off-by:' line."