mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Build/Test Tools: Don’t send a Slack notice when a workflow fails once.
[53947] introduced a callable workflow that allowed a workflow run to be retried automatic. By default all workflows are retried once. Since a run is not considered “failed” until after the automatic retry, the first Slack message is unnecessary and can cause a lot of noise when there are network hiccups. This alters the logic to skip a failure notice in Slack until the second failure. See #58867. git-svn-id: https://develop.svn.wordpress.org/trunk@56404 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2bd2a2fe84
commit
d3f193f741
7
.github/workflows/slack-notifications.yml
vendored
7
.github/workflows/slack-notifications.yml
vendored
@ -71,6 +71,11 @@ jobs:
|
||||
run_id: ${{ github.run_id }},
|
||||
});
|
||||
|
||||
// All workflows will restart once when a failure is encountered. Don't notify Slack on the first failure.
|
||||
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({
|
||||
@ -157,7 +162,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
needs: [ prepare ]
|
||||
if: ${{ inputs.calling_status == 'failure' || failure() }}
|
||||
if: ${{ ( inputs.calling_status == 'failure' || failure() ) && steps.previous-attempt-result.outputs.result != 'first-failure' }}
|
||||
|
||||
steps:
|
||||
- name: Post failure notifications to Slack
|
||||
|
||||
Loading…
Reference in New Issue
Block a user