1+ name : PythonBot - Verify PR Commits
2+
3+ on :
4+ pull_request :
5+ types : [opened, synchronize]
6+
7+ permissions :
8+ contents : read
9+ pull-requests : write
10+
11+ concurrency :
12+ group : " verify-commits-${{ github.event.pull_request.number }}"
13+ cancel-in-progress : true
14+
15+ jobs :
16+ verify-commits :
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Checkout repository
21+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22+
23+ - name : Check for unverified commits
24+ env :
25+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26+ run : |
27+ PR_NUMBER=${{ github.event.pull_request.number }}
28+ REPO="${{ github.repository }}"
29+ COMMITS_URL="https://github.com/$REPO/pull/${{ PR_NUMBER }}/commits"
30+
31+ echo "Checking commits in PR #$PR_NUMBER for repository $REPO..."
32+
33+ COMMITS_JSON=$(gh api repos/$REPO/pulls/$PR_NUMBER/commits)
34+ UNVERIFIED_COUNT=$(echo "$COMMITS_JSON" | jq '[.[] | select(.commit.verification.verified == false)] | length')
35+
36+ echo "Unverified commits: $UNVERIFIED_COUNT"
37+
38+ if [ "$UNVERIFIED_COUNT" -gt 0 ]; then
39+ COMMENT=$(cat <<EOF
40+ Hi, this is VerificationBot.
41+ Your pull request cannot be merged as it has **unverified commits**.
42+ View your commit verification status: [Commits Tab]($COMMITS_URL).
43+
44+ To achieve verified status, please read:
45+ - [Signing guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/signing.md)
46+ - [README](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/README.md)
47+ - [Discord](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/discord.md)
48+
49+ Remember, you require a GPG key and each commit must be signed with:
50+ \`git commit -S -s -m "Your message here"\`
51+
52+ Thank you for contributing!
53+
54+ From the Hiero Python SDK Team
55+ EOF )
56+
57+ gh pr view $PR_NUMBER --repo $REPO --json comments --jq '.comments[].body' | grep -F "PythonBot" >/dev/null || \
58+ (gh pr comment $PR_NUMBER --repo $REPO --body "$COMMENT" && echo "Comment added to PR #$PR_NUMBER")
59+ else
60+ echo "All commits in PR #$PR_NUMBER are verified."
61+ fi
62+
0 commit comments