-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (110 loc) · 4.02 KB
/
Copy pathcodeql.yml
File metadata and controls
122 lines (110 loc) · 4.02 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: CodeQL
on:
pull_request:
push:
branches:
- master
- main
schedule:
- cron: "17 4 * * 2"
workflow_dispatch:
permissions:
actions: read
contents: read
security-events: write
jobs:
scope:
name: Select CodeQL languages
if: ${{ github.event_name == 'workflow_dispatch' || vars.VYRAL_ENABLE_AUTOMATED_WORKFLOWS == 'true' }}
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
languages: ${{ steps.scope.outputs.languages }}
steps:
- name: Check out repository history
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Classify changed languages
id: scope
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.sha }}
run: >-
python3 scripts/classify-ci-changes.py
--event "$EVENT_NAME"
--base "$BASE_SHA"
--head "$HEAD_SHA"
analyze:
name: Analyze ${{ matrix.language }}
needs: scope
# The repository variable is the emergency pause switch for hosted gates.
# Manual dispatch remains available for controlled diagnostics.
if: ${{ github.event_name == 'workflow_dispatch' || vars.VYRAL_ENABLE_AUTOMATED_WORKFLOWS == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- language: csharp
scope: csharp
build_mode: autobuild
- language: javascript-typescript
scope: javascript
build_mode: none
- language: python
scope: python
build_mode: none
- language: go
scope: go
build_mode: autobuild
steps:
- name: Select this language
id: selection
env:
LANGUAGE_SCOPES: ${{ needs.scope.outputs.languages }}
LANGUAGE_SCOPE: ${{ matrix.scope }}
run: |
enabled="$(jq -r --arg scope "$LANGUAGE_SCOPE" '.[$scope]' <<<"$LANGUAGE_SCOPES")"
[[ "$enabled" == true || "$enabled" == false ]]
echo "enabled=$enabled" >> "$GITHUB_OUTPUT"
- name: Report unaffected language
if: ${{ steps.selection.outputs.enabled != 'true' }}
run: echo 'codeql-language=not-affected'
- name: Check out repository
if: ${{ steps.selection.outputs.enabled == 'true' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up .NET
if: ${{ steps.selection.outputs.enabled == 'true' && matrix.language == 'csharp' }}
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: 10.0.x
- name: Set up Go
if: ${{ steps.selection.outputs.enabled == 'true' && matrix.language == 'go' }}
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.26.5"
cache: false
- name: Initialize CodeQL
if: ${{ steps.selection.outputs.enabled == 'true' }}
uses: github/codeql-action/init@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build_mode }}
- name: Analyze
if: ${{ steps.selection.outputs.enabled == 'true' }}
uses: github/codeql-action/analyze@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
with:
category: /language:${{ matrix.language }}
output: artifacts/codeql/${{ matrix.language }}
upload: always
upload-database: false
- name: Upload portable CodeQL evidence
if: ${{ always() && steps.selection.outputs.enabled == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: codeql-${{ matrix.language }}-${{ github.sha }}
path: artifacts/codeql/${{ matrix.language }}
if-no-files-found: error