Skip to content

Commit 23d01bc

Browse files
committed
only notify Discord once
If we're in a matrix, and one of the jobs fail, then we only want to notify Discord once instead of for each failure.
1 parent 1638f35 commit 23d01bc

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,13 @@ jobs:
110110
- name: Run Playwright tests
111111
run: npm run test:ui
112112

113+
notify:
114+
if: ${{ always() && github.ref == 'refs/heads/main' && needs.tests.result == 'failure' }}
115+
needs: tests
116+
runs-on: ubuntu-latest
117+
steps:
113118
- name: Notify Discord
114-
if: failure() && github.ref == 'refs/heads/main'
115119
uses: discord-actions/message@v2
116120
with:
117121
webhookUrl: ${{ secrets.DISCORD_WEBHOOK_URL }}
118-
message: 'The [most recent build](<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>) on the `main` branch has failed.'
122+
message: 'The [most recent ${{ github.workflow }} workflow](<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>) on the `main` branch has failed.'

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,13 @@ jobs:
113113
env:
114114
GITHUB_WORKSPACE: ${{ github.workspace }}
115115

116+
notify:
117+
if: ${{ always() && github.ref == 'refs/heads/main' && needs.tests.result == 'failure' }}
118+
needs: tests
119+
runs-on: ubuntu-latest
120+
steps:
116121
- name: Notify Discord
117-
if: failure() && github.ref == 'refs/heads/main'
118122
uses: discord-actions/message@v2
119123
with:
120124
webhookUrl: ${{ secrets.DISCORD_WEBHOOK_URL }}
121-
message: 'The [most recent build](<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>) on the `main` branch has failed.'
125+
message: 'The [most recent ${{ github.workflow }} workflow](<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>) on the `main` branch has failed.'

0 commit comments

Comments
 (0)