mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 03:04:34 +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:
20
.github/workflows/javascript-tests.yml
vendored
20
.github/workflows/javascript-tests.yml
vendored
@@ -50,7 +50,6 @@ jobs:
|
||||
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
|
||||
# - Run the WordPress QUnit tests.
|
||||
# - Ensures version-controlled files are not modified or deleted.
|
||||
# - todo: Configure Slack notifications for failing tests.
|
||||
test-js:
|
||||
name: QUnit Tests
|
||||
runs-on: ubuntu-latest
|
||||
@@ -86,3 +85,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: [ 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 }}
|
||||
|
||||
Reference in New Issue
Block a user