Skip to content

Commit

Permalink
fix: silent unnecessary notification failures for each run (#2141)
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Roberts <[email protected]>
  • Loading branch information
mishraomp and DerekRoberts authored Oct 25, 2024
1 parent 5f6c603 commit 85aea12
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ on:
types:
- completed
jobs:
troubleshoot:
runs-on: ubuntu-24.04
steps:
- run: echo "${{ vars.MS_TEAMS_WEBHOOK_URI }}"

notify-teams-pr:
if: ${{github.event.workflow_run.event == 'pull_request'}}
if: ${{github.event.workflow_run.event == 'pull_request' && vars.MS_TEAMS_WEBHOOK_URI != null}}
runs-on: ubuntu-24.04
steps:
- uses: simbo/msteams-message-card-action@latest
if: ${{ vars.MS_TEAMS_WEBHOOK_URI != null}}
with:
webhook: ${{ vars.MS_TEAMS_WEBHOOK_URI }}
title: "${{github.event.workflow_run.head_commit.message}}"
Expand All @@ -26,10 +32,11 @@ jobs:
image: ${{github.event.workflow_run.head_repository.owner.avatar_url}}
text: PR Opened
notify-teams-merged:
if: ${{github.event.workflow_run.event == 'push'}}
if: ${{github.event.workflow_run.event == 'push' && vars.MS_TEAMS_WEBHOOK_URI != null}}
runs-on: ubuntu-24.04
steps:
- name: PR Number
if: ${{ vars.MS_TEAMS_WEBHOOK_URI != null }}
id: pr
shell: bash
run: |
Expand All @@ -46,8 +53,9 @@ jobs:
fi
echo "pr=${pr}" >> $GITHUB_OUTPUT
- uses: simbo/msteams-message-card-action@latest
if: ${{ vars.MS_TEAMS_WEBHOOK_URI }}
with:
webhook: ${{ vars.MS_TEAMS_WEBHOOK_URI }}
webhook: ${{ vars.MS_TEAMS_WEBHOOK_URI != null }}
title: "${{github.event.workflow_run.head_commit.message}}"
message: "${{github.event.workflow_run.head_commit.message}}"
color: 'dark orange'
Expand Down

0 comments on commit 85aea12

Please sign in to comment.