-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (69 loc) · 2.09 KB
/
codeql.yml
File metadata and controls
80 lines (69 loc) · 2.09 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
name: CodeQL Scan
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '20 23 * * 1'
workflow_dispatch:
jobs:
generate-scan-list:
name: Generate scan list
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
outputs:
matrix: ${{steps.set-matrix.outputs.matrix}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Find all apps
id: find-all
run: |
chmod +x ./.github/scripts/list-all
echo "::set-output name=all::$(./.github/scripts/list-all)"
- name: Setup scanning matrix
id: set-matrix
env:
ALL: ${{ steps.find-all.outputs.all }}
run: |
echo "::set-output name=matrix::$ALL"
echo "::notice::Scan list: $ALL"
codeql-scan:
name: "CodeQL(${{ matrix.languages }}): ${{matrix.target-dir}}"
needs: generate-scan-list
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-scan-list.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build CodeQL config file
env:
TARGET_DIR: ${{ matrix.target-dir }}
run: |
cp .github/codeql/codeql-config-template.yml codeql-config.yml
sed -i 's@__TARGET_DIR__@'"$TARGET_DIR"'@' codeql-config.yml
- name: Initialize CodeQL
continue-on-error: true
uses: github/codeql-action/init@v2
with:
config-file: codeql-config.yml
languages: ${{ matrix.languages }}
- name: Attempting build
continue-on-error: true
if: ${{ (matrix.languages == 'cpp' || matrix.languages == 'csharp' || matrix.languages == 'java') }}
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL analysis
continue-on-error: true
uses: github/codeql-action/analyze@v2
with:
category: ${{ matrix.target-dir }}-${{ matrix.languages }}