forked from HHS/simpler-grants-gov
-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (30 loc) · 1.12 KB
/
send-slack-notification.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Slack Notification
on: workflow_call
jobs:
send-slack-notification:
name: Send Slack notification on failure
runs-on: ubuntu-22.04
steps:
- name: Send Slack notification
run: |
curl -X POST -H "Authorization: Bearer ${{ secrets.ALERTS_SLACK_BOT_TOKEN }}" \
-H "Content-Type: application/json; charset=utf-8" \
--data '{
"channel": "${{ secrets.SLACK_ALERTS_CHANNEL_ID }}",
"text": ":x: *GitHub Actions Failure Alert*",
"attachments": [
{
"color": "#ff0000",
"title": "Workflow *'"${{ github.workflow }}"'* failed",
"fields": [
{
"title": "Workflow URL",
"value": "'"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"'"
}
],
"footer": "GitHub Actions",
"footer_icon": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"ts": '$(date +%s)'
}
]
}' https://slack.com/api/chat.postMessage