Skip to content

Commit be66f24

Browse files
committed
Avoid sigscanner for PRs from chainlink-release-pusher[bot]
1 parent 11d25cd commit be66f24

File tree

1 file changed

+70
-4
lines changed

1 file changed

+70
-4
lines changed

.github/workflows/sigscanner.yml

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,86 @@
1-
name: 'SigScanner Check'
1+
name: "SigScanner Check"
22

33
on:
4+
pull_request:
45
merge_group:
56
push:
7+
branches:
8+
- develop
9+
- release/*
10+
11+
# Public key for chainlink-release-pusher[bot]. Commits signed with the
12+
# corresponding private key are exempt from SigScanner. Stored here (not
13+
# in Secrets) so that any change requires code-review approval.
14+
env:
15+
BOT_SIGN_KEY_PUB_RELEASE_PUSHER: |
16+
-----BEGIN PGP PUBLIC KEY BLOCK-----
17+
REPLACE_WITH_ACTUAL_PUBLIC_KEY
18+
-----END PGP PUBLIC KEY BLOCK-----
619
720
jobs:
821
sigscanner-check:
22+
# Skip merge_group events — github.actor there is whoever enqueued
23+
# the merge, not the PR author, so we can't reliably attribute commits.
24+
# Especially since it's expected that we squash merge for this repo.
25+
if: github.event_name != 'merge_group'
926
runs-on: ubuntu-latest
27+
env:
28+
# On pull_request, github.sha is a temporary merge commit; use the
29+
# actual PR head commit so we verify the developer's signed commit.
30+
# On push, github.sha is the real commit on develop.
31+
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
1032
steps:
11-
- name: "SigScanner checking ${{ github.sha }} by ${{ github.actor }}"
33+
- name: Checkout commit
34+
uses: actions/checkout@v6
35+
with:
36+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
37+
fetch-depth: 1
38+
persist-credentials: false
39+
40+
- name: Check if commit is signed by release-pusher bot
41+
id: bot-sig-check
42+
run: |
43+
echo "🔑 Importing release-pusher bot public key …"
44+
echo "${BOT_SIGN_KEY_PUB_RELEASE_PUSHER}" | gpg --import 2>/dev/null
45+
46+
# Grab the fingerprint we just imported so we can match it
47+
BOT_FP=$(echo "${BOT_SIGN_KEY_PUB_RELEASE_PUSHER}" | gpg --with-colons --import-options show-only --import 2>/dev/null \
48+
| awk -F: '/^fpr/{print $10; exit}')
49+
echo "Bot key fingerprint: ${BOT_FP}"
50+
51+
# Try to verify the commit signature
52+
if git verify-commit "${COMMIT_SHA}" 2>/dev/null; then
53+
# Extract the fingerprint that signed this commit
54+
SIGN_FP=$(git log --format='%GF' -1 "${COMMIT_SHA}")
55+
if [[ "${SIGN_FP}" == "${BOT_FP}" ]]; then
56+
echo "✅ Commit is signed by the release-pusher bot — skipping SigScanner"
57+
echo "signed_by_bot=true" | tee -a "$GITHUB_OUTPUT"
58+
else
59+
echo "ℹ️ Commit is GPG-signed but NOT by the bot (signer: ${SIGN_FP})"
60+
echo "signed_by_bot=false" | tee -a "$GITHUB_OUTPUT"
61+
fi
62+
else
63+
echo "ℹ️ Commit has no valid GPG signature"
64+
echo "signed_by_bot=false" | tee -a "$GITHUB_OUTPUT"
65+
fi
66+
67+
- name: "SigScanner checking ${{ env.COMMIT_SHA }} by ${{ github.actor }}"
68+
if: steps.bot-sig-check.outputs.signed_by_bot == 'false'
1269
env:
1370
API_TOKEN: ${{ secrets.SIGSCANNER_API_TOKEN }}
1471
API_URL: ${{ secrets.SIGSCANNER_API_URL }}
1572
run: |
16-
echo "🔎 Checking commit ${{ github.sha }} by ${{ github.actor }} in ${{ github.repository }} - ${{ github.event_name }}"
17-
CODE=`curl --write-out '%{http_code}' -X POST -H "Content-Type: application/json" -H "Authorization: $API_TOKEN" --silent --output /dev/null --url "$API_URL" --data '{"commit":"${{ github.sha }}","repository":"${{ github.repository }}","author":"${{ github.actor }}"}'`
73+
echo "🔎 Checking commit ${COMMIT_SHA} by ${GITHUB_ACTOR} in ${GITHUB_REPOSITORY} - ${GITHUB_EVENT_NAME}"
74+
CODE=$(curl \
75+
--write-out '%{http_code}' \
76+
-X POST \
77+
-H "Content-Type: application/json" \
78+
-H "Authorization: $API_TOKEN" \
79+
--silent \
80+
--output /dev/null \
81+
--url "$API_URL" \
82+
--data "{\"commit\":\"${COMMIT_SHA}\",\"repository\":\"${GITHUB_REPOSITORY}\",\"author\":\"${GITHUB_ACTOR}\"}"
83+
)
1884
echo "Received $CODE"
1985
if [[ "$CODE" == "200" ]]; then
2086
echo "✅ Commit is verified"

0 commit comments

Comments
 (0)