mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +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:
@@ -56,7 +56,6 @@ jobs:
|
||||
# - Runs PHPCS on the full codebase with warnings suppressed.
|
||||
# - Runs PHPCS on the `tests` directory without warnings suppressed.
|
||||
# - Ensures version-controlled files are not modified or deleted.
|
||||
# - todo: Configure Slack notifications for failing scans.
|
||||
phpcs:
|
||||
name: PHP coding standards
|
||||
runs-on: ubuntu-latest
|
||||
@@ -110,7 +109,6 @@ jobs:
|
||||
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
|
||||
# - Run the WordPress JSHint checks.
|
||||
# - Ensures version-controlled files are not modified or deleted.
|
||||
# - todo: Configure Slack notifications for failing tests.
|
||||
jshint:
|
||||
name: JavaScript coding standards
|
||||
runs-on: ubuntu-latest
|
||||
@@ -148,3 +146,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: [ phpcs, jshint ]
|
||||
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