@@ -23,19 +23,42 @@ jobs:
2323 with :
2424 fetch-depth : 0
2525
26- - name : Ensure commits are signed
27- uses : zgosalvez/github-actions-ensure-commit-signed@v1
28- with :
29- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26+ - name : Trust soo-bak signing key
27+ shell : bash
28+ run : |
29+ set -euo pipefail
30+ mkdir -p ~/.ssh
31+ cat <<'EOF' > ~/.ssh/allowed_signers
32+ soo-bak@github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDwMav68GMpY0c5ZkVv859NppHgfzMfrCYyQuByZwNtq
33+ EOF
34+ git config --global gpg.format ssh
35+ git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers
36+
37+ - name : Enforce signed commits
38+ shell : bash
39+ run : |
40+ set -euo pipefail
41+ if [ "${{ github.event_name }}" = "pull_request" ]; then
42+ range="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
43+ elif [ -n "${{ github.event.before }}" ] && [ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]; then
44+ range="${{ github.event.before }}..${{ github.sha }}"
45+ else
46+ range="${{ github.sha }}"
47+ fi
48+
49+ while read -r commit; do
50+ if ! git verify-commit "$commit" >/dev/null 2>&1; then
51+ echo "::error::Commit $commit lacks a trusted signature" >&2
52+ exit 1
53+ fi
54+ done < <(git rev-list "$range")
3055
3156 - name : Lint commit titles
3257 shell : pwsh
3358 run : |
3459 $eventName = '${{ github.event_name }}'
3560 if ($eventName -eq 'pull_request') {
36- $base = '${{ github.event.pull_request.base.sha }}'
37- $head = '${{ github.event.pull_request.head.sha }}'
38- $range = "$base..$head"
61+ $range = '${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}'
3962 } else {
4063 $before = '${{ github.event.before }}'
4164 $after = '${{ github.sha }}'
0 commit comments