Skip to content

Commit

Permalink
Build/Test Tools: Don’t send Slack notification for workflow retries.
Browse files Browse the repository at this point in the history
[56780] changed Slack failure notifications to not send a failure notification during the first run of a workflow. Because workflows automatically restart once, a failure during the first run can be ignored.

This adjusts the workflow to also not send a “fixed” notification when the second run of a workflow succeeds after a failure. Because the original failure is no longer reported, these notifications are unnecessary.

See #58867.

git-svn-id: https://develop.svn.wordpress.org/trunk@56827 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Oct 11, 2023
1 parent 80931f0 commit ce8aed4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ jobs:
return 'first-failure';
}
// When a workflow has been restarted to fix a failure, check the previous run attempt.
if ( workflow_run.data.run_attempt > 1 ) {
// When a workflow has been restarted, check the previous run attempt. Because workflows are automatically
// restarted once and a failure on the first run is not reported, failures on the second run should not be
// considered.
if ( workflow_run.data.run_attempt > 2 ) {
const previous_run = await github.rest.actions.getWorkflowRunAttempt({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down

0 comments on commit ce8aed4

Please sign in to comment.