Skip to content

Commit 947e0c4

Browse files
authored
Add Code Scanning workflow with CodeQL and Security Scan
1 parent b0002ca commit 947e0c4

1 file changed

Lines changed: 76 additions & 0 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: "Code Scanning"
2+
3+
on:
4+
push:
5+
branches: [ develop*, release/**, beta/** ]
6+
pull_request:
7+
branches: [ develop* ]
8+
schedule:
9+
- cron: '34 8 * * 2'
10+
workflow_dispatch:
11+
12+
jobs:
13+
codeql:
14+
name: CodeQL
15+
runs-on: windows-latest
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language: [ 'csharp' ]
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Setup .NET
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: 8.x.x
34+
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v3
37+
with:
38+
languages: ${{ matrix.language }}
39+
40+
- name: Build
41+
run: dotnet build EPPlus.sln --configuration Release
42+
43+
- name: Perform CodeQL Analysis
44+
uses: github/codeql-action/analyze@v3
45+
46+
security-code-scan:
47+
name: Security Code Scan
48+
runs-on: windows-latest
49+
permissions:
50+
actions: read
51+
contents: read
52+
security-events: write
53+
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v4
57+
58+
- name: Setup .NET
59+
uses: actions/setup-dotnet@v4
60+
with:
61+
dotnet-version: 8.x.x
62+
63+
- name: Install Security Code Scan
64+
run: dotnet tool install --global security-scan
65+
66+
- name: Build
67+
run: dotnet build EPPlus.sln --configuration Release
68+
69+
- name: Run Security Code Scan
70+
run: security-scan EPPlus.sln --export=scs-results.sarif
71+
72+
- name: Upload Security Code Scan results
73+
uses: github/codeql-action/upload-sarif@v3
74+
with:
75+
sarif_file: scs-results.sarif
76+
category: security-code-scan

0 commit comments

Comments
 (0)