-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (36 loc) · 1.18 KB
/
npm-audit-alert.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
33
34
35
36
37
38
name: npm-audit-alert
on:
push:
branches: [master]
pull_request:
paths:
- "rekisterointi-ui/package.json"
- "rekisterointi-ui/package-lock.json"
schedule:
- cron: "0 12 * * *"
jobs:
npm-audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: "master"
- name: Install deps
run: npm ci
working-directory: rekisterointi-ui
- name: Run npm audit
run: |
npm audit 2>&1 | tee audit.log
result_code=${PIPESTATUS[0]}
content="$(cat audit.log)"
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "content=$content" >> "$GITHUB_OUTPUT"
exit $result_code
id: run_audit
working-directory: rekisterointi-ui
- name: Send Slack alert if previous steps failed
if: failure()
run: |
curl -X POST -H 'Content-type: application/json' --data '{"channel": "#yleiskäyttöiset-alerts", "icon_emoji": ":warning:", "text": "*${{ github.repository }}:*\n${{ steps.run_audit.outputs.content }}"}' ${{ secrets.SLACK_WEBHOOK_URL }}