Skip to content

Commit 899133b

Browse files
feat: add max number of comments to commit verification bot (#904)
Signed-off-by: Antonio Ceppellini <antonio.ceppellini@gmail.com>
1 parent e24b9b4 commit 899133b

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

.github/workflows/bot-verified-commits.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,16 @@ jobs:
3838
3939
echo "Unverified commits: $UNVERIFIED_COUNT"
4040
41+
EXISTING_BOT_COMMENT_COUNT=$(gh pr view $PR_NUMBER --repo $REPO --json comments | jq '[.comments[] | select(.author.login == "github-actions" and (.body | contains("[commit-verification-bot]")))] | length')
42+
43+
echo "Existing verification commit bot comments: $EXISTING_BOT_COMMENT_COUNT"
44+
4145
if [ "$UNVERIFIED_COUNT" -gt 0 ]; then
42-
COMMENT=$(cat <<EOF
46+
if [ "$EXISTING_BOT_COMMENT_COUNT" -ge 1 ]; then
47+
echo "VerificationBot already commented. Skipping additional comments."
48+
else
49+
COMMENT=$(cat <<EOF
50+
[commit-verification-bot]
4351
Hi, this is VerificationBot.
4452
Your pull request cannot be merged as it has **unverified commits**.
4553
View your commit verification status: [Commits Tab]($COMMITS_URL).
@@ -58,9 +66,11 @@ jobs:
5866
EOF
5967
)
6068

61-
gh pr view $PR_NUMBER --repo $REPO --json comments --jq '.comments[].body' | grep -F "PythonBot" >/dev/null || \
62-
(gh pr comment $PR_NUMBER --repo $REPO --body "$COMMENT" && echo "Comment added to PR #$PR_NUMBER")
69+
gh pr comment $PR_NUMBER --repo $REPO --body "$COMMENT"
70+
echo "Comment added to PR #$PR_NUMBER"
71+
fi
72+
73+
exit 1
6374
else
6475
echo "All commits in PR #$PR_NUMBER are verified."
6576
fi
66-

CHANGELOG.md

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

2121
### Added
2222

23+
- Add a limit of one comment for PR to the commit verification bot. [#892]
2324
- Removed `actions/checkout@v4` from `bot-verified-commits.yml`
2425
- Add comprehensive documentation for `ReceiptStatusError` in `docs/sdk_developers/training/receipt_status_error.md`
2526
- Add practical example `examples/errors/receipt_status_error.py` demonstrating transaction error handling

0 commit comments

Comments
 (0)