-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (86 loc) · 2.58 KB
/
Copy pathcodeql.yml
File metadata and controls
99 lines (86 loc) · 2.58 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: CodeQL
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
types: [ opened, synchronize, reopened, ready_for_review ]
schedule:
- cron: '0 6 * * 1'
concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
security-events: write
jobs:
changes:
name: Detect changed languages
if: github.event.pull_request.draft != true
runs-on: ubuntu-latest
outputs:
languages: ${{ steps.languages.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Filter
id: filter
if: github.event_name == 'pull_request'
uses: dorny/paths-filter@v4
with:
filters: |
csharp:
- 'src/**'
- 'tests/**'
- 'Directory.Build.props'
- 'global.json'
- '.github/workflows/codeql.yml'
python:
- 'python/**'
- '.github/workflows/codeql.yml'
- name: Select languages
id: languages
run: |
if [ '${{ github.event_name }}' != 'pull_request' ]; then
echo 'value=["csharp","python"]' >> "$GITHUB_OUTPUT"
exit 0
fi
languages=()
if [ '${{ steps.filter.outputs.csharp }}' = 'true' ]; then
languages+=('"csharp"')
fi
if [ '${{ steps.filter.outputs.python }}' = 'true' ]; then
languages+=('"python"')
fi
echo "value=[$(IFS=,; echo "${languages[*]}")]" >> "$GITHUB_OUTPUT"
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.languages != '[]'
strategy:
fail-fast: false
matrix:
language: ${{ fromJSON(needs.changes.outputs.languages) }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup .NET
if: matrix.language == 'csharp'
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
cache: true
cache-dependency-path: '**/*.csproj'
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
queries: security-extended
- name: Build (Release)
if: matrix.language == 'csharp'
run: dotnet build ExcelReader.slnx --configuration Release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"