-
Notifications
You must be signed in to change notification settings - Fork 3
80 lines (71 loc) · 2.05 KB
/
Copy pathdependency-audit.yml
File metadata and controls
80 lines (71 loc) · 2.05 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
name: Dependency Audit
on:
pull_request:
branches: [main]
paths:
- package.json
- bun.lock
- .github/workflows/dependency-audit.yml
push:
branches: [main]
paths:
- package.json
- bun.lock
- .github/workflows/dependency-audit.yml
schedule:
- cron: "17 9 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: dependency-audit-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
lockfile:
name: Check Bun lockfile
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Verify lockfile is current
run: bun install --frozen-lockfile --dry-run
audit:
name: Audit dependencies
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run Bun audit
run: |
set +e
bun audit --audit-level=moderate | tee audit.txt
audit_status="${PIPESTATUS[0]}"
set -e
{
echo "## Bun Audit"
echo
if [ "$audit_status" -eq 0 ]; then
echo "No moderate-or-higher advisories found."
else
echo "> Advisory only: moderate-or-higher advisories were found. This job reports them without blocking CI."
echo
fi
echo '```text'
cat audit.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
if [ "$audit_status" -ne 0 ]; then
echo "::warning::bun audit found moderate-or-higher advisories. See the job summary for details."
fi