-
-
Notifications
You must be signed in to change notification settings - Fork 170
98 lines (86 loc) · 2.62 KB
/
Copy pathcodeql.yml
File metadata and controls
98 lines (86 loc) · 2.62 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
---
name: "CodeQL"
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
- cron: "24 8 * * 2"
merge_group:
permissions: {}
jobs:
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
tests: ${{ steps.filter.outputs.tests }}
steps:
- uses: actions/checkout@v6.0.3
with:
persist-credentials: false
- uses: dorny/paths-filter@v4.0.1
id: filter
with:
base: main
filters: |
src:
- "src/**"
- "**.cpp"
- "**.h"
- "**.hpp"
- "**.c"
tests:
- "tests/**"
analyze:
needs: changes
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["cpp"]
steps:
- name: Check if analysis needed
id: need_analysis
shell: bash
run: |
if [[ "${NEEDS_CHANGES_OUTPUTS_SRC}" == "true" ]] || \
[[ "${NEEDS_CHANGES_OUTPUTS_TESTS}" == "true" ]] || \
[[ "${{ github.event_name }}" == "merge_group" ]] || \
[[ "${{ github.event_name }}" == "schedule" ]]; then
echo "run_analysis=true" >> "$GITHUB_OUTPUT"
else
echo "run_analysis=false" >> "$GITHUB_OUTPUT"
fi
env:
NEEDS_CHANGES_OUTPUTS_SRC: ${{ needs.changes.outputs.src }}
NEEDS_CHANGES_OUTPUTS_TESTS: ${{ needs.changes.outputs.tests }}
- name: No changes - skipping
if: steps.need_analysis.outputs.run_analysis != 'true'
run: echo "No relevant changes - skipping CodeQL analysis"
- name: Checkout repository
if: steps.need_analysis.outputs.run_analysis == 'true'
uses: actions/checkout@v6.0.3
with:
persist-credentials: false
- name: Initialize CodeQL
if: steps.need_analysis.outputs.run_analysis == 'true'
uses: github/codeql-action/init@v4.36.2
with:
languages: ${{ matrix.language }}
- name: Install Qt
if: steps.need_analysis.outputs.run_analysis == 'true'
uses: jurplel/install-qt-action@v4.3.1
- name: Autobuild
if: steps.need_analysis.outputs.run_analysis == 'true'
uses: github/codeql-action/autobuild@v4.36.2
- name: Perform CodeQL Analysis
if: steps.need_analysis.outputs.run_analysis == 'true'
uses: github/codeql-action/analyze@v4.36.2
with:
category: "/language:${{matrix.language}}"