1
- # For most projects, this workflow file will not need changing; you simply need
2
- # to commit it to your repository.
3
- #
4
- # You may wish to alter this file to override the set of languages analyzed,
5
- # or to provide custom queries or build logic.
6
1
name : " CodeQL"
7
2
8
3
on :
4
+ push :
5
+ branches : [ 'main' ]
6
+ pull_request :
7
+ branches : [ 'main' ]
9
8
schedule :
10
9
- cron : ' 0 0 * * *' # once in a day at 00:00
11
10
workflow_dispatch :
12
11
13
- permissions :
14
- contents : read
12
+ permissions : {}
15
13
16
14
jobs :
17
15
analyze :
18
16
permissions :
19
17
actions : read # for github/codeql-action/init to get workflow details
20
18
contents : read # for actions/checkout to fetch code
21
19
security-events : write # for github/codeql-action/analyze to upload SARIF results
22
- name : Analyze
23
20
runs-on : windows-latest
24
21
25
22
strategy :
26
23
fail-fast : false
27
24
matrix :
28
- language : ['csharp']
25
+ language : ['actions', ' csharp']
29
26
30
27
steps :
31
- - name : configure Pagefile
28
+ - name : Configure Pagefile
29
+ if : matrix.language == 'csharp'
32
30
uses : al-cheb/configure-pagefile-action@a3b6ebd6b634da88790d9c58d4b37a7f4a7b8708 # v1.4
33
31
with :
34
32
minimum-size : 8GB
@@ -37,17 +35,37 @@ jobs:
37
35
38
36
- name : Checkout repository
39
37
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38
+ with :
39
+ filter : ' tree:0'
40
+ persist-credentials : false
41
+ show-progress : false
40
42
41
43
- name : Initialize CodeQL
42
44
uses : github/codeql-action/init@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
43
45
with :
46
+ build-mode : none
44
47
languages : ${{ matrix.language }}
45
48
46
- - name : Setup dotnet
47
- uses : actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
48
-
49
- - name : dotnet pack
50
- run : dotnet pack ./build/OpenTelemetry.proj --configuration Release
51
-
52
49
- name : Perform CodeQL Analysis
53
50
uses : github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
51
+ with :
52
+ category : ' /language:${{ matrix.language }}'
53
+
54
+ codeql :
55
+ if : ${{ !cancelled() }}
56
+ needs : [ analyze ]
57
+ runs-on : ubuntu-latest
58
+
59
+ steps :
60
+ - name : Report status
61
+ shell : bash
62
+ env :
63
+ SCAN_SUCCESS : ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
64
+ run : |
65
+ if [ "${SCAN_SUCCESS}" == "true" ]
66
+ then
67
+ echo 'CodeQL analysis successful'
68
+ else
69
+ echo 'CodeQL analysis failed'
70
+ exit 1
71
+ fi
0 commit comments