Skip to content

Commit 3bd37f2

Browse files
Merge pull request #97 from vimal-java-dev/feature/fix-latest
All 3 merge methods (merge, squash, rebase)
2 parents a22084c + d1814b4 commit 3bd37f2

1 file changed

Lines changed: 34 additions & 19 deletions

File tree

.github/workflows/doc-check-linter.yml

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,48 @@ jobs:
6363
fi
6464
6565
# ---------- Verify latest commit ----------
66-
- name: Verify latest commit signature
66+
- name: Verify commit signature
6767
run: |
6868
if [ "${{ github.event_name }}" = "pull_request" ]; then
69-
LATEST_COMMIT=${{ github.event.pull_request.head.sha }}
70-
else
71-
LATEST_COMMIT=$(git rev-parse HEAD)
72-
fi
69+
echo "🔍 PR mode: verifying ALL commits in PR"
7370
74-
echo "🔍 Verifying commit: $LATEST_COMMIT"
71+
BASE=${{ github.event.pull_request.base.sha }}
72+
HEAD=${{ github.event.pull_request.head.sha }}
7573
76-
if git verify-commit "$LATEST_COMMIT" >/dev/null 2>&1; then
77-
echo "✅ Signature is cryptographically valid"
78-
else
79-
echo "❌ Invalid or missing GPG signature"
80-
exit 1
81-
fi
74+
# Get all commits in PR
75+
COMMITS=$(git rev-list $BASE..$HEAD)
76+
77+
for COMMIT in $COMMITS; do
78+
echo "🔎 Checking commit: $COMMIT"
79+
80+
# Step 1: Cryptographic verification
81+
if git verify-commit "$COMMIT" >/dev/null 2>&1; then
82+
echo "✅ Signature valid"
83+
else
84+
echo "❌ Commit not signed properly"
85+
exit 1
86+
fi
87+
88+
# Step 2: Fingerprint check
89+
FINGERPRINT=$(git log -1 --pretty=format:'%GF' "$COMMIT")
90+
echo "🔑 Fingerprint: $FINGERPRINT"
8291
83-
FINGERPRINT=$(git log -1 --pretty=format:'%GF' "$LATEST_COMMIT")
84-
echo "🔑 Signing fingerprint: $FINGERPRINT"
92+
TRUSTED_KEYS="83FB991D930D7177F25456C07F4C7CA953E1C09E D432152833DA3244"
8593
86-
TRUSTED_KEYS="83FB991D930D7177F25456C07F4C7CA953E1C09E D432152833DA3244 4AEE18F83AFDEB23 B5690EEEBB952194"
94+
if echo "$TRUSTED_KEYS" | grep -q "$FINGERPRINT"; then
95+
echo "✅ Trusted key"
96+
else
97+
echo "❌ Untrusted key!"
98+
exit 1
99+
fi
100+
done
87101
88-
if echo "$TRUSTED_KEYS" | grep -q "$FINGERPRINT"; then
89-
echo "✅ Trusted signer"
102+
echo "🎉 All PR commits are valid and trusted"
103+
90104
else
91-
echo "❌ Untrusted signing key!"
92-
exit 1
105+
echo "🔍 Push to main detected"
106+
echo "ℹ️ Skipping strict GPG verification for merge/rebase/squash commit"
107+
git log -1 --oneline
93108
fi
94109

95110
# ---------- Optional status for skipped forked PRs ----------

0 commit comments

Comments
 (0)