Skip to content

Commit ec02ac8

Browse files
committed
Merge #234: ci: check commits are GPG signed
5fc139b ci: add workflow to check signed commits (Byron Hambly) Pull request description: Adds a new workflow to check that commits are GPG signed as required for merging ACKs for top commit: apoelstra: ACK 5fc139b; successfully ran local tests Tree-SHA512: 8ec3bef11f55db7d2937430092f9127506b371fccce73d6e6570d7e3ed3454b85fd550ac83514580b54c1382a81f6aff19bfc8229292775a8304bb83f9b40c60
2 parents 897e3f8 + 5fc139b commit ec02ac8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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."

0 commit comments

Comments
 (0)