forked from mkaring/ConfuserEx
-
Notifications
You must be signed in to change notification settings - Fork 4
56 lines (45 loc) · 1.8 KB
/
Copy pathcodeql-analysis.yml
File metadata and controls
56 lines (45 loc) · 1.8 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
name: "CodeQL"
on:
schedule:
- cron: "0 3 * * 1" # Every Monday 3am UTC
workflow_dispatch: # Manual trigger from Actions tab
permissions:
contents: read
security-events: write
actions: read
jobs:
analyze:
name: Analyze
runs-on: windows-2025
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check for recent commits
id: check
shell: pwsh
run: |
$count = (git log --oneline --since="7 days ago" | Measure-Object).Count
echo "has_changes=$($count -gt 0)" >> $env:GITHUB_OUTPUT
Write-Host "Commits in last 7 days: $count"
- name: Initialize CodeQL
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
uses: github/codeql-action/init@v3
with:
languages: csharp
- name: Setup MSBuild
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
uses: microsoft/setup-msbuild@v2
- name: Restore
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
run: msbuild Confuser2.sln -t:Restore -verbosity:minimal
- name: Build
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
run: msbuild Confuser2.sln -p:Configuration=Release -verbosity:minimal
- name: Perform CodeQL Analysis
if: steps.check.outputs.has_changes == 'True' || github.event_name == 'workflow_dispatch'
uses: github/codeql-action/analyze@v3
- name: Skip notice
if: steps.check.outputs.has_changes != 'True' && github.event_name != 'workflow_dispatch'
run: echo "No commits in the last 7 days — skipping analysis."