Skip to content

Require Developer Certificate of Origin (DCO) #3

Require Developer Certificate of Origin (DCO)

Require Developer Certificate of Origin (DCO) #3

Workflow file for this run

name: DCO Check
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
dco:
name: Check Signed-off-by in commits
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Important: fetch full history so origin/base_ref exists!
- name: Check commits for Signed-off-by
run: |
git fetch origin ${{ github.base_ref }}
git log origin/${{ github.base_ref }}..HEAD --pretty=format:"%h %s%n%b%n==END==" |
awk '
BEGIN { commit = ""; has_signed_off = 0; }
/==END==/ {
if (!has_signed_off) {
print "Commit " commit " is missing Signed-off-by";
exit 1;
}
commit = "";
has_signed_off = 0;
next;
}
/^[0-9a-f]{7,40} / { commit = $1; next; }
/Signed-off-by:/ { has_signed_off = 1; }
'