-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (53 loc) · 1.94 KB
/
Copy pathsecurity.yml
File metadata and controls
58 lines (53 loc) · 1.94 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
name: Security Audit
on:
schedule:
- cron: "0 8 * * 1" # chaque lundi à 8h UTC
workflow_dispatch:
jobs:
audit:
name: Dependency Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with: { version: 10.26.1 }
- uses: actions/setup-node@v4
with: { node-version: 22, cache: pnpm }
- run: pnpm install --frozen-lockfile
- name: Run pnpm audit
id: audit
run: pnpm audit --audit-level=moderate
continue-on-error: true
- name: Open issue if vulnerabilities found
if: steps.audit.outcome == 'failure'
uses: actions/github-script@v7
with:
script: |
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['security'],
state: 'open',
})
if (issues.length === 0) {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: '🚨 [Security] Vulnerabilities detected in dependencies',
labels: ['security', 'urgent'],
body: `## Automatic Security Audit\n\nThe weekly audit has detected vulnerabilities.\n\n**Action:** Run \`pnpm audit\` locally for details.\n\n**Run:** ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}\n\n*Created automatically — Security Audit workflow*`
})
}
codeql:
name: CodeQL Analysis
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with: { languages: typescript }
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3