Skip to content

Feature: Expected answer is not recorded as yet for Musicality Battery #1408

Feature: Expected answer is not recorded as yet for Musicality Battery

Feature: Expected answer is not recorded as yet for Musicality Battery #1408

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: |
echo "${{ github.event.issue.title }}" | sed 's/"/\\"/g' > escaped_title.txt
ISSUE_TITLE=$(cat escaped_title.txt)
curl -H "Content-Type: application/json" -d "{\"text\": \"🚀 Issue Assigned: $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: |
echo "${{ github.event.pull_request.title }}" | sed 's/"/\\"/g' > escaped_title.txt
PR_TITLE=$(cat escaped_title.txt)
curl -H "Content-Type: application/json" -d "{\"text\": \"🚀 PR Assigned: $PR_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: |
echo "${{ github.event.pull_request.title }}" | sed 's/"/\\"/g' > escaped_title.txt
PR_TITLE=$(cat escaped_title.txt)
curl -H "Content-Type: application/json" -d "{\"text\": \"🎉 PR Merged: $PR_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 }}