Skip to content

Commit

Permalink
CI: Add Teams Notifications workflow (#667)
Browse files Browse the repository at this point in the history
* ci: Add Teams Notifications workflow

* ci: Update types for pull_request event
  • Loading branch information
drikusroor authored Dec 19, 2023
1 parent a161212 commit 7aedd60
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/teams-notifications.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Teams Notifications

on:
issues:
types: [assigned]
pull_request:
types: [assigned, closed, opened]
workflow_run:
workflows: ["Test suite"]
types:
- completed

jobs:
notify_teams:
runs-on: ubuntu-latest
if: always() # This ensures that the notification runs even if the workflow fails
steps:
- name: Notify Teams on Issue Assignment
if: github.event_name == 'issues'
run: |
curl -H "Content-Type: application/json" -d "{\"text\": \"🚀 Issue Assigned: ${{ github.event.issue.title }} assigned to ${{ github.event.issue.assignee.login }}\"}" ${{ secrets.TEAMS_WEBHOOK_URL }}
- name: Notify Teams on Pull Request Assignment
if: github.event_name == 'pull_request' && github.event.action == 'assigned'
run: |
curl -H "Content-Type: application/json" -d "{\"text\": \"🚀 PR Assigned: ${{ github.event.pull_request.title }} assigned to ${{ github.event.pull_request.assignee.login }}\"}" ${{ secrets.TEAMS_WEBHOOK_URL }}
- name: Notify Teams on Pull Request Merged
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
run: |
curl -H "Content-Type: application/json" -d "{\"text\": \"🎉 PR Merged: ${{ github.event.pull_request.title }}\"}" ${{ secrets.TEAMS_WEBHOOK_URL }}
- name: Notify Teams on Pipeline Failure
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure'
run: |
curl -H "Content-Type: application/json" -d "{\"text\": \"⚠️ Pipeline Failed: ${{ github.event.workflow_run.name }} failed\"}" ${{ secrets.TEAMS_WEBHOOK_URL }}

0 comments on commit 7aedd60

Please sign in to comment.