Skip to content

Commit d6919b2

Browse files
committed
ci: add workflow to verify commits touching key files (#41)
1 parent eb07811 commit d6919b2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Verify commit signature on key files
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
paths:
7+
- keys/
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- keys/
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
verify-signature:
23+
if: github.event.pull_request.draft == false
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
with:
28+
fetch-depth: 0 # We need all the commits to be sure to find the specific one with the signature.
29+
persist-credentials: false
30+
- name: Validate PGP signature on key files
31+
run: |
32+
git diff ${{ github.event.before || 'HEAD^' }} --name-only --diff-filter=d -- keys/ | while read -r KEY_FILE; do
33+
export GNUPGHOME=$(mktemp -d)
34+
chmod 700 "$GNUPGHOME"
35+
gpg --import "$KEY_FILE"
36+
git verify-commit "$(git log -1 --format=%H -- "$KEY_FILE")"
37+
rm -r "$GNUPGHOME"
38+
done

0 commit comments

Comments
 (0)