Require Developer Certificate of Origin (DCO) #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | |
' |