Skip to content

ci: webbhook to post failure in teams channel #3

ci: webbhook to post failure in teams channel

ci: webbhook to post failure in teams channel #3

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"