Repository navigation
69 lines (58 loc) · 1.87 KB
/
Copy pathcodeql.yml
File metadata and controls
69 lines (58 loc) · 1.87 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
name: CodeQL
on:
pull_request:
branches: [ "master", "Development" ]
schedule:
# Every Sunday 06:00 UTC. The first step skips alternate weeks,
# so the scheduled scan effectively runs every 2 weeks.
- cron: '0 6 * * 0'
workflow_dispatch:
permissions:
contents: read
jobs:
analyze:
runs-on: windows-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Decide whether to run
id: gate
shell: bash
run: |
if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then
week=$(( $(date -u +%s) / 604800 ))
if (( week % 2 != 0 )); then
echo "Off week - skipping the scheduled scan."
echo "run=false" >> "$GITHUB_OUTPUT"
exit 0
fi
fi
echo "run=true" >> "$GITHUB_OUTPUT"
- name: Checkout code
if: steps.gate.outputs.run == 'true'
uses: actions/checkout@v5
- name: Setup MSBuild
if: steps.gate.outputs.run == 'true'
uses: microsoft/setup-msbuild@v3
- name: Setup NuGet
if: steps.gate.outputs.run == 'true'
uses: NuGet/setup-nuget@v3
- name: Initialize CodeQL
if: steps.gate.outputs.run == 'true'
uses: github/codeql-action/init@v4
with:
languages: csharp
build-mode: manual
- name: Restore NuGet packages
if: steps.gate.outputs.run == 'true'
run: dotnet restore Tunetastic.sln --configfile nuget.config
- name: Build
if: steps.gate.outputs.run == 'true'
run: msbuild Tunetastic.sln /p:Configuration=Debug /p:Platform=x64 /p:AppxPackageSigningEnabled=false
- name: Perform CodeQL analysis
if: steps.gate.outputs.run == 'true'
uses: github/codeql-action/analyze@v4
with:
category: "/language:csharp"