Skip to content

Commit

Permalink
ci: send google chat notification on failure
Browse files Browse the repository at this point in the history
JIRA: CI-331
  • Loading branch information
nalajcie committed Aug 31, 2023
1 parent ba6c67a commit f7b43d7
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/_send_google_chat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# vim:sw=2:ts=2
# reusable workflow for sending google chat messages notifying about build failures
name: send-notif

# on events
on:
workflow_call:

jobs:
send-notif:
runs-on: ubuntu-latest

steps:
- name: Debug details
run: |
echo "Workflow name: ${{ github.workflow }}"
echo "Event name: ${{ github.event_name }}"
echo "Repo: ${{ github.repository }}"
echo "Repo URL: ${{ github.repositoryUrl }}"
echo "Repo URL: ${{ github.server_url }}/${{ github.repository }}"
echo "Actions URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- name: Send Google Chat Notification
run: |
curl --location --request POST '${{ secrets.GOOGLE_CHAT_CI_WEBHOOK }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"cards": [
{
"sections": [
{
"widgets": [
{
"textParagraph": {
"text": "Workflow '<b>${{ github.workflow }}</b>' <b><font color='#ff0000'>FAILED</font></b>"
}
}
]
},
{
"widgets": [
{
"keyValue": {
"topLabel": "Repo",
"content": "${{ github.repository }}",
"iconUrl": "https://git-scm.com/images/logos/logomark-black@2x.png",
"button": {
"textButton": {
"text": "OPEN",
"onClick": {
"openLink": {
"url": "${{ github.server_url }}/${{ github.repository }}"
}
}
}
}
}
},
{
"keyValue": {
"topLabel": "Event",
"icon": "TICKET",
"content": "${{ github.event_name }}"
}
},
{
"buttons": [
{
"textButton": {
"text": "OPEN FAILED RUN",
"onClick": {
"openLink": {
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
}
}
]
}
]
}
]
}
]
}'
7 changes: 7 additions & 0 deletions .github/workflows/ci-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ jobs:
files: "junit.xml"


send-notification:
needs: ['build', 'test-emu', 'test-hw']
if: failure() && github.event_name != 'pull_request'
uses: phoenix-rtos/phoenix-rtos-project/.github/workflows/_send_google_chat.yml@master
secrets: inherit


mail-notification:
if: failure()
needs: ['build', 'test-emu', 'test-hw']
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci-submodule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ jobs:
check_name: Unit Test Results
files: "junit.xml"


send-notification:
needs: ['build', 'test-emu', 'test-hw']
if: failure() && github.event_name != 'pull_request'
uses: phoenix-rtos/phoenix-rtos-project/.github/workflows/_send_google_chat.yml@master
secrets: inherit


mail-notification:
if: failure()
needs: ['build', 'test-emu', 'test-hw']
Expand Down

0 comments on commit f7b43d7

Please sign in to comment.