-
Notifications
You must be signed in to change notification settings - Fork 17
92 lines (74 loc) · 2.6 KB
/
dependency-audit.yml
File metadata and controls
92 lines (74 loc) · 2.6 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Dependency Vulnerability Audit
on:
push:
branches: [main]
pull_request:
branches: [main]
paths-ignore:
- '**/*.md'
schedule:
# Run weekly on Mondays at 00:00 UTC
- cron: '0 0 * * 1'
workflow_dispatch:
permissions:
contents: read
security-events: write
jobs:
audit-main:
name: Audit Main Package
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run npm audit (JSON output for SARIF)
run: npm audit --json > npm-audit-main.json || true
- name: Convert npm audit to SARIF
if: always()
run: npx tsx scripts/ci/npm-audit-to-sarif.ts npm-audit-main.json npm-audit-main.sarif
- name: Upload npm audit SARIF to GitHub Security tab
if: always()
uses: github/codeql-action/upload-sarif@f68537f3d8a6955880f700730943f8a754454193 # v4
with:
sarif_file: npm-audit-main.sarif
category: npm-audit-main
- name: Run npm audit (fail on high/critical)
run: npm audit --audit-level=high
audit-docs:
name: Audit Docs Site Package
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: docs-site/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: docs-site
- name: Run npm audit (JSON output for SARIF)
run: npm audit --json > npm-audit-docs.json || true
working-directory: docs-site
- name: Convert npm audit to SARIF
if: always()
run: npx tsx scripts/ci/npm-audit-to-sarif.ts docs-site/npm-audit-docs.json npm-audit-docs.sarif
- name: Upload npm audit SARIF to GitHub Security tab
if: always()
uses: github/codeql-action/upload-sarif@f68537f3d8a6955880f700730943f8a754454193 # v4
with:
sarif_file: npm-audit-docs.sarif
category: npm-audit-docs
- name: Run npm audit (fail on high/critical)
run: npm audit --audit-level=high
working-directory: docs-site