Skip to content

Commit 3a44a2d

Browse files
feat(ci-cd): add audit scan (#158)
add audit scan GH-157
1 parent b736789 commit 3a44a2d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/audit.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Audit
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
npm_audit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Checks-out your repository under $GITHUB_WORKSPACE
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: 20.x
18+
19+
- name: Install Monorepo Deps
20+
run: npm ci
21+
22+
- name: Run npm audit
23+
run: >
24+
npm audit --json |
25+
node -e '
26+
const fs = require("fs");
27+
const auditLevel = (process.argv[1] || "critical").toLowerCase();
28+
const { vulnerabilities } = JSON.parse(fs.readFileSync(0).toString("utf-8"));
29+
const result = Object.values(vulnerabilities).filter((i) => i.severity.toLowerCase() === auditLevel);
30+
console.table(JSON.stringify(result, null, 2));
31+
' high

0 commit comments

Comments
 (0)