Skip to content

Commit 7a60b8e

Browse files
committed
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
1 parent 2905c5a commit 7a60b8e

11 files changed

+174
-9
lines changed

.github/workflows/coding-standards.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ jobs:
5656
# - Runs PHPCS on the full codebase with warnings suppressed.
5757
# - Runs PHPCS on the `tests` directory without warnings suppressed.
5858
# - Ensures version-controlled files are not modified or deleted.
59-
# - todo: Configure Slack notifications for failing scans.
6059
phpcs:
6160
name: PHP coding standards
6261
runs-on: ubuntu-latest
@@ -110,7 +109,6 @@ jobs:
110109
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
111110
# - Run the WordPress JSHint checks.
112111
# - Ensures version-controlled files are not modified or deleted.
113-
# - todo: Configure Slack notifications for failing tests.
114112
jshint:
115113
name: JavaScript coding standards
116114
runs-on: ubuntu-latest
@@ -148,3 +146,22 @@ jobs:
148146

149147
- name: Ensure version-controlled files are not modified or deleted
150148
run: git diff --exit-code
149+
150+
# Post workflow related status updates to Slack.
151+
#
152+
# When a job in this workflow fails, a message is posted to #core.
153+
#
154+
# This job should always require all other jobs in this workflow to complete before running.
155+
slack-notifications:
156+
name: Slack Notifications
157+
runs-on: ubuntu-latest
158+
needs: [ phpcs, jshint ]
159+
if: ${{ failure() && github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' }}
160+
161+
steps:
162+
- name: Post failure notification to Slack
163+
uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
164+
with:
165+
payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
166+
env:
167+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}

.github/workflows/end-to-end-tests.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
# - Install WordPress within the Docker container.
4747
# - Run the E2E tests.
4848
# - Ensures version-controlled files are not modified or deleted.
49-
# - todo: Configure Slack notifications for failing tests.
5049
e2e-tests:
5150
name: E2E Tests
5251
runs-on: ubuntu-latest
@@ -117,3 +116,22 @@ jobs:
117116

118117
- name: Ensure version-controlled files are not modified or deleted
119118
run: git diff --exit-code
119+
120+
# Post workflow related status updates to Slack.
121+
#
122+
# When a job in this workflow fails, a message is posted to #core.
123+
#
124+
# This job should always require all other jobs in this workflow to complete before running.
125+
slack-notifications:
126+
name: Slack Notifications
127+
runs-on: ubuntu-latest
128+
needs: [ e2e-tests ]
129+
if: ${{ failure() && github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' }}
130+
131+
steps:
132+
- name: Post failure notification to Slack
133+
uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
134+
with:
135+
payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
136+
env:
137+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}

.github/workflows/javascript-tests.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
5151
# - Run the WordPress QUnit tests.
5252
# - Ensures version-controlled files are not modified or deleted.
53-
# - todo: Configure Slack notifications for failing tests.
5453
test-js:
5554
name: QUnit Tests
5655
runs-on: ubuntu-latest
@@ -86,3 +85,22 @@ jobs:
8685

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

.github/workflows/php-compatibility.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ jobs:
5050
# - Logs PHP_CodeSniffer debug information.
5151
# - Runs the PHP compatibility tests.
5252
# - Ensures version-controlled files are not modified or deleted.
53-
# - todo: Configure Slack notifications for failing scans.
54-
php-comatibility:
53+
php-compatibility:
5554
name: Check PHP compatibility
5655
runs-on: ubuntu-latest
5756
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
@@ -88,3 +87,22 @@ jobs:
8887

8988
- name: Ensure version-controlled files are not modified or deleted
9089
run: git diff --exit-code
90+
91+
# Post workflow related status updates to Slack.
92+
#
93+
# When a job in this workflow fails, a message is posted to #core.
94+
#
95+
# This job should always require all other jobs in this workflow to complete before running.
96+
slack-notifications:
97+
name: Slack Notifications
98+
runs-on: ubuntu-latest
99+
needs: [ php-compatibility ]
100+
if: ${{ failure() && github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' }}
101+
102+
steps:
103+
- name: Post failure notification to Slack
104+
uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
105+
with:
106+
payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
107+
env:
108+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}

.github/workflows/phpunit-tests.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ jobs:
5959
# - Checks out the WordPress Test reporter repository.
6060
# - Reconnect the directory to the Git repository.
6161
# - Submit the test results to the WordPress.org host test results.
62-
# - todo: Configure Slack notifications for failing tests.
6362
test-php:
6463
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
6564
runs-on: ${{ matrix.os }}
@@ -237,3 +236,22 @@ jobs:
237236
env:
238237
WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
239238
run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
239+
240+
# Post workflow related status updates to Slack.
241+
#
242+
# When a job in this workflow fails, a message is posted to #core.
243+
#
244+
# This job should always require all other jobs in this workflow to complete before running.
245+
slack-notifications:
246+
name: Slack Notifications
247+
runs-on: ubuntu-latest
248+
needs: [ test-php ]
249+
if: ${{ failure() && github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' }}
250+
251+
steps:
252+
- name: Post failure notification to Slack
253+
uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
254+
with:
255+
payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
256+
env:
257+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}

.github/workflows/test-coverage.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,22 @@ jobs:
146146
with:
147147
file: wp-code-coverage-multisite-clover-${{ github.sha }}.xml
148148
flags: multisite,php
149+
150+
# Post workflow related status updates to Slack.
151+
#
152+
# When a job in this workflow fails, a message is posted to #core.
153+
#
154+
# This job should always require all other jobs in this workflow to complete before running.
155+
slack-notifications:
156+
name: Slack Notifications
157+
runs-on: ubuntu-latest
158+
needs: [ test-coverage-report ]
159+
if: ${{ failure() && github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' }}
160+
161+
steps:
162+
- name: Post failure notification to Slack
163+
uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
164+
with:
165+
payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
166+
env:
167+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}

.github/workflows/test-npm.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,22 @@ jobs:
154154

155155
- name: Ensure version-controlled files are not modified or deleted during building and cleaning
156156
run: git diff --exit-code
157+
158+
# Post workflow related status updates to Slack.
159+
#
160+
# When a job in this workflow fails, a message is posted to #core.
161+
#
162+
# This job should always require all other jobs in this workflow to complete before running.
163+
slack-notifications:
164+
name: Slack Notifications
165+
runs-on: ubuntu-latest
166+
needs: [ test-npm, test-npm-macos ]
167+
if: ${{ failure() && github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' }}
168+
169+
steps:
170+
- name: Post failure notification to Slack
171+
uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
172+
with:
173+
payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
174+
env:
175+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}

.github/workflows/test-old-branches.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,22 @@ jobs:
6969
workflow_id: '${{ matrix.workflow }}',
7070
ref: '${{ matrix.branch }}'
7171
});
72+
73+
# Post workflow related status updates to Slack.
74+
#
75+
# When a job in this workflow fails, a message is posted to #core.
76+
#
77+
# This job should always require all other jobs in this workflow to complete before running.
78+
slack-notifications:
79+
name: Slack Notifications
80+
runs-on: ubuntu-latest
81+
needs: [ dispatch-workflows-for-old-branches ]
82+
if: ${{ failure() }}
83+
84+
steps:
85+
- name: Post failure notification to Slack
86+
uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
87+
with:
88+
payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
89+
env:
90+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}

.github/workflows/welcome-new-contributors.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,22 @@ jobs:
5757
Thank you,
5858
5959
The WordPress Project
60+
61+
# Post workflow related status updates to Slack.
62+
#
63+
# When a job in this workflow fails, a message is posted to #core.
64+
#
65+
# This job should always require all other jobs in this workflow to complete before running.
66+
slack-notifications:
67+
name: Slack Notifications
68+
runs-on: ubuntu-latest
69+
needs: [ post-welcome-message ]
70+
if: ${{ failure() }}
71+
72+
steps:
73+
- name: Post failure notification to Slack
74+
uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
75+
with:
76+
payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
77+
env:
78+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}

src/wp-cron.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function _get_cron_lock() {
6060
global $wpdb;
6161

6262
$value = 0;
63-
if ( wp_using_ext_object_cache() ) {
63+
if (wp_using_ext_object_cache()) {
6464
/*
6565
* Skip local cache and force re-fetch of doing_cron transient
6666
* in case another process updated the cache.

0 commit comments

Comments
 (0)