Skip to content

Commit b5b00bc

Browse files
committed
ci(workspace): add pnpm audit workflow to scan dependencies
introduce automated security scanning for dependencies by running `npm audit` in pull requests. this ensures vulnerabilities are caught earlier in the development cycle and increases visibility for reviewers. Closes #153
1 parent 9275cad commit b5b00bc

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/npm-audit.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# -------------------------------------------------------------------------------------
2+
#
3+
# Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
4+
#
5+
# WSO2 LLC. licenses this file to you under the Apache License,
6+
# Version 2.0 (the "License"); you may not use this file except
7+
# in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
# --------------------------------------------------------------------------------------
20+
21+
# This workflow will perform a security audit on the codebase.
22+
23+
name: Security Audit
24+
25+
on:
26+
pull_request:
27+
branches: [ main ]
28+
29+
jobs:
30+
audit:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 18
40+
41+
- name: Install pnpm
42+
uses: pnpm/action-setup@v4
43+
with:
44+
version: 9
45+
46+
- name: Install dependencies
47+
run: pnpm install
48+
49+
- name: Run audit
50+
run: |
51+
pnpm audit --json > audit-results.json || true
52+
pnpm audit --audit-level=high
53+
54+
- name: Upload audit results
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: pnpm-audit-report
58+
path: audit-results.json

0 commit comments

Comments
 (0)