Skip to content

docs(exp/about-sru): migrate from kteam-docs (#31) #28

docs(exp/about-sru): migrate from kteam-docs (#31)

docs(exp/about-sru): migrate from kteam-docs (#31) #28

name: Verify Commit Signoff
on:
push:
branches:
- main
pull_request:
branches:
- '*'
workflow_dispatch:
jobs:
verify-signoff:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full history is available
- name: Validate commits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Fetch full history for main branch
git fetch origin ${{ github.event.pull_request.base.ref }} --quiet
# Determine the commit to verify:
# For pull requests, verify HEAD commit of the pull request branch
# For pushes (squash-merge), verify the latest commit in the branch
if [ "${{ github.event_name }}" = "pull_request" ]; then
TARGET_COMMIT=${{ github.event.pull_request.head.sha }}
else
TARGET_COMMIT=$(git rev-parse HEAD)
fi
# Check the commit message for 'Signed-off-by:'
MESSAGE=$(git show -s --format='%B' $TARGET_COMMIT)
if ! echo "$MESSAGE" | grep -q "Signed-off-by:"; then
echo "❌ Commit $TARGET_COMMIT is missing a 'Signed-off-by:' line."
exit 1
fi
echo "✅ Commit $TARGET_COMMIT is properly signed off."