Skip to content

Commit 85aea12

Browse files
fix: silent unnecessary notification failures for each run (#2141)
Co-authored-by: Derek Roberts <[email protected]>
1 parent 5f6c603 commit 85aea12

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/notifications.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ on:
55
types:
66
- completed
77
jobs:
8+
troubleshoot:
9+
runs-on: ubuntu-24.04
10+
steps:
11+
- run: echo "${{ vars.MS_TEAMS_WEBHOOK_URI }}"
12+
813
notify-teams-pr:
9-
if: ${{github.event.workflow_run.event == 'pull_request'}}
14+
if: ${{github.event.workflow_run.event == 'pull_request' && vars.MS_TEAMS_WEBHOOK_URI != null}}
1015
runs-on: ubuntu-24.04
1116
steps:
1217
- uses: simbo/msteams-message-card-action@latest
18+
if: ${{ vars.MS_TEAMS_WEBHOOK_URI != null}}
1319
with:
1420
webhook: ${{ vars.MS_TEAMS_WEBHOOK_URI }}
1521
title: "${{github.event.workflow_run.head_commit.message}}"
@@ -26,10 +32,11 @@ jobs:
2632
image: ${{github.event.workflow_run.head_repository.owner.avatar_url}}
2733
text: PR Opened
2834
notify-teams-merged:
29-
if: ${{github.event.workflow_run.event == 'push'}}
35+
if: ${{github.event.workflow_run.event == 'push' && vars.MS_TEAMS_WEBHOOK_URI != null}}
3036
runs-on: ubuntu-24.04
3137
steps:
3238
- name: PR Number
39+
if: ${{ vars.MS_TEAMS_WEBHOOK_URI != null }}
3340
id: pr
3441
shell: bash
3542
run: |
@@ -46,8 +53,9 @@ jobs:
4653
fi
4754
echo "pr=${pr}" >> $GITHUB_OUTPUT
4855
- uses: simbo/msteams-message-card-action@latest
56+
if: ${{ vars.MS_TEAMS_WEBHOOK_URI }}
4957
with:
50-
webhook: ${{ vars.MS_TEAMS_WEBHOOK_URI }}
58+
webhook: ${{ vars.MS_TEAMS_WEBHOOK_URI != null }}
5159
title: "${{github.event.workflow_run.head_commit.message}}"
5260
message: "${{github.event.workflow_run.head_commit.message}}"
5361
color: 'dark orange'

0 commit comments

Comments
 (0)