Repository navigation
84 lines (72 loc) · 2.84 KB
/
Copy pathcodeql.yml
File metadata and controls
84 lines (72 loc) · 2.84 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
name: CodeQL
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '30 2 * * 1'
workflow_dispatch:
permissions:
contents: read
security-events: write
concurrency:
group: codeql-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze (CodeQL)
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
config-file: ./.github/codeql/codeql-config.yml
languages: csharp
- name: Setup .NET SDK (repo pin)
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Restore solution
run: dotnet restore VectorNNTPD.slnx -p:Platform=x64
# --no-incremental ensures CoreCompile/csc runs under the CodeQL tracer for every
# project. An up-to-date incremental skip can leave only .csproj entries in the DB.
- name: Build solution
run: dotnet build VectorNNTPD.slnx --configuration Release -p:Platform=x64 --no-restore --no-incremental
# upload: never — traced C# SARIF includes **/obj/** source-generator noise that
# paths-ignore cannot drop. Filter first, then upload-sarif.
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
upload: never
output: codeql-sarif
- name: Filter generated bin/obj findings from SARIF
shell: pwsh
run: |
$inputs = Get-ChildItem -Path codeql-sarif -Filter *.sarif -File -ErrorAction Stop
if ($inputs.Count -lt 1) {
throw "No SARIF files found under codeql-sarif/"
}
New-Item -ItemType Directory -Force -Path codeql-sarif-filtered | Out-Null
foreach ($sarif in $inputs) {
$out = Join-Path codeql-sarif-filtered $sarif.Name
# StripAcceptedSuppressions: in-source // codeql[...] findings stay justified in
# the repo; uploading them as results still produced "new alerts" on PR #256
# because CodeQL's {state:accepted} was not treated as GitHub dismissals.
& ./tools/Filter-CodeQlSarif.ps1 -InputPath $sarif.FullName -OutputPath $out -StripAcceptedSuppressions
}
# Keep the historical analysis category so GitHub's required CodeQL check continues
# to match refs/heads/master (category "csharp" yielded NEUTRAL
# "1 configuration not found" on PR #256 check run 123524079410).
- name: Upload filtered CodeQL SARIF
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: codeql-sarif-filtered
category: ".github/workflows/codeql.yml:analyze"