Skip to content

Commit 0bd1f9e

Browse files
authored
feat: failed workflow bot (#758)
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
1 parent dacc523 commit 0bd1f9e

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: PythonBot - Workflow Failure Notifier
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_run:
6+
workflows:
7+
- "PR Formatting"
8+
- "Hiero Solo Integration Tests"
9+
- "Run Examples"
10+
types:
11+
- completed
12+
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
17+
jobs:
18+
notify-pr:
19+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Get associated PR number
23+
id: get-pr
24+
run: |
25+
# Get "id" from the workflow run
26+
HEAD_BRANCH=$(gh run view ${{ github.event.workflow_run.id }} \
27+
--repo ${{ github.repository }} \
28+
--json headBranch --jq '.headBranch')
29+
30+
# Find the PR number for this branch
31+
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --state all --head "$HEAD_BRANCH" --json number --jq '.[0].number')
32+
33+
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
34+
35+
36+
- name: Comment on PR
37+
if: env.PR_NUMBER != ''
38+
env:
39+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: |
41+
REPO="${{ github.repository }}"
42+
COMMENT=$(cat <<EOF
43+
Hi, this is WorkflowBot.
44+
Your pull request cannot be merged as it is not passing all our workflow checks.
45+
Please click on each check to review the logs and resolve issues so all checks pass.
46+
47+
To help you:
48+
- [DCO signing guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/signing.md)
49+
- [Changelog guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/changelog_entry.md)
50+
- [Merge conflicts guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/merge_conflicts.md)
51+
- [Rebase guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/rebasing.md)
52+
- [Testing guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/testing.md)
53+
- [Discord](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/discord.md)
54+
- [Community Calls](https://zoom-lfx.platform.linuxfoundation.org/meetings/hiero?view=week)
55+
56+
Thank you for contributing!
57+
From the Hiero Python SDK Team
58+
EOF
59+
)
60+
gh pr comment "$PR_NUMBER" --repo "$REPO" --body "$COMMENT"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
2323
- `alias`, `staked_account_id`, `staked_node_id` and `decline_staking_reward` fields to AccountCreateTransaction
2424
- `staked_account_id`, `staked_node_id` and `decline_staking_reward` fields to AccountInfo
2525
- Added `examples/token_create_transaction_supply_key.py` to demonstrate token creation with and without a supply key.
26+
- workflow: bot workflow which notifies developers of workflow failures in their pull requests.
2627

2728
### Changed
2829
- Refactored token-related example scripts (`token_delete.py`, `token_dissociate.py`, etc.) for improved readability and modularity. [#370]

0 commit comments

Comments
 (0)