Skip to content

Commit dacc523

Browse files
authored
feat: verification bot (#756)
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
1 parent afc1f11 commit dacc523

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
88

99

1010
### Added
11+
- Add workflow: github bot to respond to unverified PR commits (#750)
1112
- Add `examples/token_create_transaction_max_automatic_token_associations_0.py` to demonstrate how `max_automatic_token_associations=0` behaves.
1213
- Add `examples/topic_id.py` to demonstrate `TopicId` opeartions
1314
- Add `examples/topic_message.py` to demonstrate `TopicMessage` and `TopicMessageChunk` with local mock data.

0 commit comments

Comments
 (0)