mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Build/Test Tools: Post a message to #core in Slack when a workflow fails.
This adds an additional step to each GitHub Action workflow file that posts a message to #core in Slack every time a workflow run fails. A minor test and spacing change is included in this commit in order to that messages are posted correctly and will be reverted after testing. See #52644. git-svn-id: https://develop.svn.wordpress.org/trunk@51511 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -50,8 +50,7 @@ jobs:
|
||||
# - Logs PHP_CodeSniffer debug information.
|
||||
# - Runs the PHP compatibility tests.
|
||||
# - Ensures version-controlled files are not modified or deleted.
|
||||
# - todo: Configure Slack notifications for failing scans.
|
||||
php-comatibility:
|
||||
php-compatibility:
|
||||
name: Check PHP compatibility
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
@@ -88,3 +87,22 @@ 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: [ php-compatibility ]
|
||||
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 }}
|
||||
|
||||
Reference in New Issue
Block a user