Skip to content

Commit 67414d7

Browse files
authored
Post to slack only on run failure. (#376)
1 parent fd0e0c0 commit 67414d7

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/serverless-vuln-scan.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ on:
44
schedule:
55
# daily at midnight
66
- cron: "0 0 * * *"
7+
workflow_dispatch:
78

89
env:
910
VERSION: 1 # env var required when building extension
1011

1112
jobs:
12-
run:
13+
check:
1314
runs-on: ubuntu-latest
1415
steps:
1516
- name: Checkout datadog-agent repository
@@ -108,3 +109,26 @@ jobs:
108109
fail-build: true
109110
severity-cutoff: low
110111
output-format: table
112+
113+
notify:
114+
needs: check
115+
if: failure()
116+
runs-on: ubuntu-latest
117+
steps:
118+
- name: Notify
119+
env:
120+
SLACK_CHANNEL: "#serverless-agent"
121+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
122+
run: |
123+
set -x
124+
125+
OPS_MESSAGE=":gh-check-failed: Serverless Vulnerability Scan failed! :radar-scan:
126+
127+
Whoever is on support, please fix the vulnerability, before a customer alerts us to it.
128+
129+
See ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} for the full info on the found vulnerability. :bufo-thanks:"
130+
131+
curl -H "Content-type: application/json" -X POST "$SLACK_WEBHOOK" -d '{
132+
"channel": "'"$SLACK_CHANNEL"'",
133+
"text": "'"$OPS_MESSAGE"'"
134+
}'

0 commit comments

Comments
 (0)