Skip to content

Commit

Permalink
Build/Test Tools: Don’t send a Slack notice for a workflow’s first fa…
Browse files Browse the repository at this point in the history
…ilure.

After [53947], all workflows will automatically be restarted once in an attempt to rule out reasons for failures, such as timeouts or network hiccups.

Second attempt at [56404], which was previously reverted in [56407].
See #58867.

git-svn-id: https://develop.svn.wordpress.org/trunk@56780 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Oct 4, 2023
1 parent 058cd25 commit 0d844c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ jobs:
run_id: ${{ github.run_id }},
});
if ( '${{ inputs.calling_status }}' == 'failure' && workflow_run.data.run_attempt == 1 ) {
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 ) {
const previous_run = await github.rest.actions.getWorkflowRunAttempt({
Expand Down Expand Up @@ -157,7 +161,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [ prepare ]
if: ${{ inputs.calling_status == 'failure' || failure() }}
if: ${{ needs.prepare.outputs.previous_conclusion != 'first-failure' && inputs.calling_status == 'failure' || failure() }}

steps:
- name: Post failure notifications to Slack
Expand Down

0 comments on commit 0d844c1

Please sign in to comment.