Skip to content

chore: bad test names test #60

chore: bad test names test

chore: bad test names test #60

name: PythonBot - Verify PR Commits
on:
pull_request_target:
types: [opened, synchronize]
permissions:
contents: read
pull-requests: write
issues: write
concurrency:
group: "verify-commits-${{ github.event.pull_request.number }}"
cancel-in-progress: true
jobs:
verify-commits:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Check for unverified commits
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
REPO="${{ github.repository }}"
COMMITS_URL="https://github.com/$REPO/pull/${PR_NUMBER}/commits"
echo "Checking commits in PR #$PR_NUMBER for repository $REPO..."
COMMITS_JSON=$(gh api repos/$REPO/pulls/$PR_NUMBER/commits)
UNVERIFIED_COUNT=$(echo "$COMMITS_JSON" | jq '[.[] | select(.commit.verification.verified == false)] | length')
echo "Unverified commits: $UNVERIFIED_COUNT"
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')
echo "Existing verification commit bot comments: $EXISTING_BOT_COMMENT_COUNT"
if [ "$UNVERIFIED_COUNT" -gt 0 ]; then
if [ "$EXISTING_BOT_COMMENT_COUNT" -ge 1 ]; then
echo "VerificationBot already commented. Skipping additional comments."
else
COMMENT=$(cat <<EOF
[commit-verification-bot]
Hi, this is VerificationBot.
Your pull request cannot be merged as it has **unverified commits**.
View your commit verification status: [Commits Tab]($COMMITS_URL).
To achieve verified status, please read:
- [Signing guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/signing.md)
- [README](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/README.md)
- [Discord](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/discord.md)
Remember, you require a GPG key and each commit must be signed with:
\`git commit -S -s -m "Your message here"\`
Thank you for contributing!
From the Hiero Python SDK Team
EOF
)
gh pr comment $PR_NUMBER --repo $REPO --body "$COMMENT"
echo "Comment added to PR #$PR_NUMBER"
fi
exit 1
else
echo "All commits in PR #$PR_NUMBER are verified."
fi