Skip to content

Commit 2ebd8b7

Browse files
author
abadhwar
committed
Add Npm Audit
1 parent ecb2ae5 commit 2ebd8b7

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/cli-core-audit.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: NPM Audit Check
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
7+
jobs:
8+
audit:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
node-version: [16.x, 14.x]
14+
steps:
15+
- name: Checkout cli repo
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- run: make install
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'npm'
25+
- name: Run audit check
26+
run: npm audit --audit-level=moderate --production
27+
# minimum vulnerability level that will cause the command to fail
28+
# audit reports with low severity would pass the test
29+
notify-complete-fail:
30+
if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
31+
needs: [ audit ]
32+
name: Notify Npm Audit Failed
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Slack Notification
37+
uses: rtCamp/action-slack-notify@v2
38+
env:
39+
SLACK_WEBHOOK: ${{ secrets.ALERT_SLACK_WEB_HOOK }}
40+
SLACK_COLOR: 'danger'
41+
SLACK_USERNAME: CLI Github Actions
42+
SLACK_MSG_AUTHOR: twilio-dx
43+
SLACK_ICON_EMOJI: ':github:'
44+
SLACK_TITLE: "Twilio Cli"
45+
SLACK_MESSAGE: 'Cli audit test failed'
46+
MSG_MINIMAL: actions url
47+
SLACK_FOOTER: Posted automatically using GitHub Actions

0 commit comments

Comments
 (0)