Skip to content

Commit 5dd1887

Browse files
author
Anuj Badhwar
authored
chore: Add Npm Audit workflow (#196)
1 parent 8805a00 commit 5dd1887

File tree

2 files changed

+50
-4
lines changed

2 files changed

+50
-4
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

.github/workflows/release.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
token-validation:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- name: Validate REPO_ACCESS_TOKEN
18+
- name: Validate REPO_ACCESS_TOKEN
1919
uses: actions/checkout@v2
2020
with:
2121
repository: 'twilio/twilio-oai'
@@ -66,8 +66,7 @@ jobs:
6666
run: make test
6767
update-api-specs:
6868
runs-on: ubuntu-latest
69-
needs: [ token-validation ]
70-
# needs: [test]
69+
needs: [ test ]
7170
outputs:
7271
change-log: ${{ steps.update-specs.outputs.change-log }}
7372
version-type: ${{ steps.update-specs.outputs.version-type }}
@@ -157,4 +156,4 @@ jobs:
157156
SLACK_ICON_EMOJI: ":ship:"
158157
SLACK_TITLE: "Twilio Cli-core"
159158
SLACK_MESSAGE: 'Release workflow Failed'
160-
MSG_MINIMAL: actions url
159+
MSG_MINIMAL: actions url

0 commit comments

Comments
 (0)