Skip to content

Commit 36d1e9e

Browse files
committed
Prevent empty notifications when prepare fails.
Because of the `failure()` check, the `failure` job runs even when the message's payload is not properly prepared. This adds an additional check to guard against scenarios where the `payload` output is empty.
1 parent bf4c174 commit 36d1e9e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.github/workflows/slack-notifications.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
runs-on: ubuntu-24.04
168168
timeout-minutes: 20
169169
needs: [ prepare ]
170-
if: ${{ needs.prepare.outputs.previous_conclusion != 'first-failure' && inputs.calling_status == 'failure' || failure() }}
170+
if: ${{ ( needs.prepare.outputs.previous_conclusion != 'first-failure' && inputs.calling_status == 'failure' || failure() ) && needs.prepare.outputs.payload }}
171171

172172
steps:
173173
- name: Post failure notifications to Slack
@@ -218,7 +218,7 @@ jobs:
218218
runs-on: ubuntu-24.04
219219
timeout-minutes: 20
220220
needs: [ prepare ]
221-
if: ${{ inputs.calling_status == 'cancelled' || cancelled() }}
221+
if: ${{ ( inputs.calling_status == 'cancelled' || cancelled() ) && needs.prepare.outputs.payload }}
222222

223223
steps:
224224
- name: Post cancelled notifications to Slack

0 commit comments

Comments
 (0)