Build/Test Tools: Expand Slack notifications for GitHub Actions.

This expands Slack notifications to include success, cancelled, and “fixed” GitHub Action workflow run outcomes in addition to failures.

A “fixed” outcome occurs when the previous run for a workflow failed and the current one succeeds. This matches the behavior that was native to TravisCI by setting `on_success` for notifications to `change`.

The message details and where each outcome is posted is controlled by Slack workflows.

The Slack notification logic has also been pulled into a separate workflow to prevent repeating code in every workflow.

See #52644.

git-svn-id: https://develop.svn.wordpress.org/trunk@51535 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2021-08-03 13:45:02 +00:00
parent f117c74c6a
commit ce0396ba76
12 changed files with 123 additions and 173 deletions

View File

@@ -85,22 +85,3 @@ jobs:
- name: Ensure version-controlled files are not modified or deleted
run: git diff --exit-code
# Post workflow related status updates to Slack.
#
# When a job in this workflow fails, a message is posted to #core.
#
# This job should always require all other jobs in this workflow to complete before running.
slack-notifications:
name: Slack Notifications
runs-on: ubuntu-latest
needs: [ test-js ]
if: ${{ failure() && github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' }}
steps:
- name: Post failure notification to Slack
uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
with:
payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}