Improve slack cancellation alerts - #12454
Conversation
This changes the logic for cancellation notifications in Slack to only send a cancellation notice only when the run is cancelled on the second attempt. Because a `cancelled` status can represent several different outcomes (manually cancelled, timeout value reached, etc.), this notification type is often unnecessarily noisy.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
This PR extends the reusable Slack notifications workflow to distinguish timeouts from other cancellations, and wires a new Slack webhook secret through the various CI workflows that call it.
Changes:
- Add a new required reusable-workflow secret (
SLACK_GHA_TIMEOUT_WEBHOOK) and pass it from all calling workflows. - Detect timeouts by querying workflow-run-attempt jobs via the GitHub REST API and exposing the result as a job output.
- Split notifications into separate
cancelledvstimeoutjobs based on that detection.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/workflow-lint.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/upgrade-testing.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/upgrade-develop-testing.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/test-old-branches.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/test-coverage.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/test-build-processes.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/test-and-zip-default-themes.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/slack-notifications.yml | Adds the timeout webhook secret, detects timed-out runs, and posts a dedicated timeout notification instead of treating it as a cancellation. |
| .github/workflows/phpunit-tests.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/phpstan-static-analysis.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/php-compatibility.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/performance.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/local-docker-environment.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/javascript-type-checking.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/javascript-tests.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/install-testing.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/end-to-end-tests.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
| .github/workflows/coding-standards.yml | Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.
Suppressed comments (1)
.github/workflows/slack-notifications.yml:243
- The
cancelledjob condition still allows this job to run whenevercancelled()is true, which can bypass the newgithub.run_attempt == 2gating and also bypass thetimed_outsplit (a timed-out run is typically also considered cancelled). This can lead to cancelled notifications being posted on attempt 1 and/or alongside the new timeout notification.
Consider relying on the explicit inputs.calling_status (already computed by callers) and remove the || cancelled() fallback, or at least include the same run_attempt/timed_out gating in that path as well.
if: ${{ ( inputs.calling_status == 'cancelled' && github.run_attempt == 2 && needs.prepare.outputs.timed_out != 'true' ) || cancelled() }}
lancewillett
left a comment
There was a problem hiding this comment.
No blockers. Logic is sound.
This changes the logic that controls when a cancelled notification is posted to Slack so that only the second run is reported as cancelled to avoid too many notifications from being posted.
Additionally, there is new logic added to distinguish workflows that time out from cancelled ones. The available GitHub Actions functions and contexts to not make a
timed_outoutcome available, but the REST API does.Trac ticket: Core-65845.
Use of AI Tools
Claude Code was used to create the initial PR.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.