Skip to content

ci(github): action

ci(github): action #1

Workflow file for this run

name: Verify Signed Commits
on:
pull_request:
branches: [ develop, master ]
push:
branches: [ develop, master ]
jobs:
verify-commits:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify Commits
run: |
# Get all commits in the PR/push
if [ "${{ github.event_name }}" = "pull_request" ]; then
COMMITS=$(git log --format=%H ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }})
else
COMMITS=$(git log --format=%H HEAD^..HEAD)
fi
# Check each commit
echo "Checking commits for valid signatures..."
EXIT_CODE=0
for commit in $COMMITS; do
echo "Verifying commit: $commit"
if ! git verify-commit $commit 2>/dev/null; then
echo "❌ Commit $commit is not signed with a valid GPG key"
git log -1 --pretty=format:"%h - %s (%an)" $commit
EXIT_CODE=1
else
echo "✅ Commit $commit has a valid signature"
fi
done
if [ $EXIT_CODE -ne 0 ]; then
echo "::error::Found commits without valid GPG signatures"
exit 1
fi