Skip to content

discussion-webhook #358

discussion-webhook

discussion-webhook #358

name: "discussion-webhook"
on:
discussion:
types: ["created", "answered", "unanswered"]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: "Google Chat notification"
run: |
[ $(curl --location -X POST '${{secrets.WEBHOOK_CHAT_URL}}&threadKey=${{github.event.discussion.number}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"cards": [{
"header": {
"title": "Discussion #${{ github.event.discussion.number }} is ${{ github.event.action }}",
"subtitle": "Discussion tracker bot"
},
"sections": {
"widgets": [{
"keyValue": {
"topLabel": "Title",
"content": "${{ github.event.discussion.title }}"
}
},
{
"keyValue": {
"topLabel": "Category",
"content": "${{ github.event.discussion.category.name }}"
}
},
{
"buttons": [{
"textButton": {
"text": "OPEN DISCUSSION",
"onClick": {
"openLink": {
"url": "${{github.event.discussion.html_url}}"
}
}
}
}]
}
]
}
}]
}' -o /dev/null -w '%{http_code}') -eq 200 ]