|
| 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" |
0 commit comments