File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ on : # yamllint disable-line rule:truthy
2+ pull_request :
3+
4+ name : Verify signed commits
5+
6+ jobs :
7+ Check-Signatures :
8+ name : Check GPG signatures
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : " Checkout repo"
12+ uses : actions/checkout@v4
13+ with :
14+ fetch-depth : 0
15+
16+ - name : " Verify all PR commits are signed"
17+ run : |
18+ set -euo pipefail
19+ base="${{ github.event.pull_request.base.sha }}"
20+ head="${{ github.event.pull_request.head.sha }}"
21+ unsigned=""
22+ for sha in $(git rev-list "$base".."$head"); do
23+ sig=$(git log --format='%G?' -1 "$sha")
24+ if [ "$sig" != "G" ] && [ "$sig" != "U" ] && [ "$sig" != "E" ]; then
25+ unsigned="$unsigned $sha"
26+ echo "::error::Commit $sha is not GPG signed (signature status: $sig)"
27+ fi
28+ done
29+ if [ -n "$unsigned" ]; then
30+ echo ""
31+ echo "The following commits are not signed:$unsigned"
32+ echo "Please sign your commits with a GPG key."
33+ exit 1
34+ fi
35+ echo "All commits are GPG signed."
You can’t perform that action at this time.
0 commit comments