Skip to content

Commit a883c1f

Browse files
committed
add pre-commit to check signing
1 parent cf6b089 commit a883c1f

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

.github/workflows/sync_copilot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
schedule:
66
- cron: '0 6 * * 1'
77

8+
permissions: {}
9+
810
jobs:
911
sync-copilot-instructions:
1012
runs-on: ubuntu-22.04
@@ -14,7 +16,7 @@ jobs:
1416

1517
steps:
1618
- name: Sync shared instructions
17-
uses: NHSDigital/eps-copilot-instructions@a7849a16aabd5c1edef13e29467a480fa08555f8
19+
uses: NHSDigital/eps-copilot-instructions@304ab2f4b7cdc15a1d7c0a0fae5290fad41b2451
1820
with:
1921
copilot_instructions_ref: main
2022
calling_repo_base_branch: main

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,34 @@ repos:
4949
- -c
5050
- 'git-secrets --pre_commit_hook'
5151
language: system
52+
- id: check-commit-signing
53+
name: Check commit signing
54+
description: Ensures that commits are GPG signed
55+
entry: bash
56+
args:
57+
- -c
58+
- |
59+
if ! git config --get user.signingkey > /dev/null 2>&1; then
60+
echo "Error: Git signing key not configured."
61+
echo "Please configure your GPG signing key with:"
62+
echo " git config user.signingkey <YOUR_GPG_KEY_ID>"
63+
echo ""
64+
echo "To find your GPG key ID, run: gpg --list-secret-keys --keyid-format=long"
65+
echo "For more information, see: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits"
66+
exit 1
67+
fi
68+
if ! git config --get commit.gpgsign | grep -q "true" > /dev/null 2>&1; then
69+
echo "Error: Commit signing is not enabled."
70+
echo "Please enable commit signing with:"
71+
echo " git config commit.gpgsign true"
72+
echo ""
73+
echo "For more information, see: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits"
74+
exit 1
75+
fi
76+
echo "Commit signing is properly configured."
77+
language: system
78+
pass_filenames: false
79+
always_run: true
5280

5381
fail_fast: true
5482
default_stages: [pre-commit]

0 commit comments

Comments
 (0)