@@ -29,24 +29,40 @@ jobs:
2929 - name : Checkout repository
3030 uses : actions/checkout@v4
3131
32+ - name : Check for C# sources
33+ id : csharp_sources
34+ shell : bash
35+ run : |
36+ if git ls-files '*.cs' '*.csproj' | grep -q .; then
37+ echo "present=true" >> "$GITHUB_OUTPUT"
38+ else
39+ echo "present=false" >> "$GITHUB_OUTPUT"
40+ echo "No C# sources found; skipping CodeQL C# analysis."
41+ fi
42+
3243 - name : Setup .NET (from global.json)
44+ if : steps.csharp_sources.outputs.present == 'true'
3345 uses : actions/setup-dotnet@v4
3446 with :
3547 global-json-file : global.json
3648
3749 - name : Initialize CodeQL
50+ if : steps.csharp_sources.outputs.present == 'true'
3851 uses : github/codeql-action/init@v4
3952 with :
4053 languages : ${{ matrix.language }}
4154 build-mode : ${{ matrix.build-mode }}
4255
4356 - name : Restore dependencies
57+ if : steps.csharp_sources.outputs.present == 'true'
4458 run : dotnet restore ARCP.slnx
4559
4660 - name : Build
61+ if : steps.csharp_sources.outputs.present == 'true'
4762 run : dotnet build ARCP.slnx --configuration Release --no-restore
4863
4964 - name : Perform CodeQL Analysis
65+ if : steps.csharp_sources.outputs.present == 'true'
5066 uses : github/codeql-action/analyze@v4
5167 with :
5268 category : " /language:${{ matrix.language }}"
0 commit comments