|
38 | 38 | security-events: write |
39 | 39 | actions: read |
40 | 40 | contents: read |
| 41 | + |
| 42 | + slack-notifications: |
| 43 | + name: Slack Notifications |
| 44 | + uses: ./.github/workflows/slack-notifications.yml |
| 45 | + permissions: |
| 46 | + actions: read |
| 47 | + contents: read |
| 48 | + needs: [ lint ] |
| 49 | + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} |
| 50 | + with: |
| 51 | + calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} |
| 52 | + secrets: |
| 53 | + SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} |
| 54 | + SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} |
| 55 | + SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} |
| 56 | + SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} |
| 57 | + |
| 58 | + failed-workflow: |
| 59 | + name: Failed workflow tasks |
| 60 | + runs-on: ubuntu-24.04 |
| 61 | + permissions: |
| 62 | + actions: write |
| 63 | + needs: [ slack-notifications ] |
| 64 | + if: | |
| 65 | + always() && |
| 66 | + github.repository == 'WordPress/wordpress-develop' && |
| 67 | + github.event_name != 'pull_request' && |
| 68 | + github.run_attempt < 2 && |
| 69 | + ( |
| 70 | + contains( needs.*.result, 'cancelled' ) || |
| 71 | + contains( needs.*.result, 'failure' ) |
| 72 | + ) |
| 73 | +
|
| 74 | + steps: |
| 75 | + - name: Dispatch workflow run |
| 76 | + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
| 77 | + with: |
| 78 | + retries: 2 |
| 79 | + retry-exempt-status-codes: 418 |
| 80 | + script: | |
| 81 | + github.rest.actions.createWorkflowDispatch({ |
| 82 | + owner: context.repo.owner, |
| 83 | + repo: context.repo.repo, |
| 84 | + workflow_id: 'failed-workflow.yml', |
| 85 | + ref: 'trunk', |
| 86 | + inputs: { |
| 87 | + run_id: `${context.runId}`, |
| 88 | + } |
| 89 | + }); |
0 commit comments