ci: webbhook to post failure in teams channel #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'ci: smoke test failure webhook' | |
on: | |
push: | |
branches: | |
- build/smoketest-webhook | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Post failure in Teams channel | |
env: | |
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }} | |
REPO_NAME: ${{ github.repository }} | |
BRANCH_NAME: ${{ github.ref }} | |
COMMIT_SHA: ${{ github.sha }} | |
RUN_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' | |
run: | | |
curl -H 'Content-Type: application/json' -d '{ | |
"type": "message", | |
"attachments": [ | |
{ | |
"contentType": "application/vnd.microsoft.card.adaptive", | |
"content": { | |
"type": "AdaptiveCard", | |
"version": "1.0", | |
"body": [ | |
{ | |
"type": "TextBlock", | |
"size": "Medium", | |
"weight": "Bolder", | |
"text": "Build Failure Notification" | |
}, | |
{ | |
"type": "FactSet", | |
"facts": [ | |
{ | |
"title": "Repository", | |
"value": "'"${REPO_NAME}"'" | |
}, | |
{ | |
"title": "Branch", | |
"value": "'"${BRANCH_NAME}"'" | |
}, | |
{ | |
"title": "Commit", | |
"value": "'"${COMMIT_SHA}"'" | |
} | |
] | |
} | |
], | |
"actions": [ | |
{ | |
"type": "Action.OpenUrl", | |
"title": "View failed run", | |
"url": "'"${RUN_URL}"'" | |
} | |
] | |
} | |
} | |
] | |
}' "$TEAMS_WEBHOOK_URL" |