Repository navigation
91 lines (79 loc) · 2.7 KB
/
Copy pathcodeql.yml
File metadata and controls
91 lines (79 loc) · 2.7 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
name: CodeQL
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 2 * * 0"
workflow_dispatch:
inputs:
force_full:
description: Run analysis regardless of path filters
required: false
default: false
type: boolean
# SonarQube S8264: declare permissions per job, not at workflow scope.
permissions: {}
concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: detect-changes
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
run_go: ${{ steps.detect.outputs.run_go }}
run_security: ${{ steps.detect.outputs.run_security }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: ${{ github.event_name == 'push' && '2' || '0' }}
persist-credentials: false
- id: detect
uses: ./.github/actions/detect-changes
with:
fetch-depth: ${{ github.event_name == 'push' && '2' || '0' }}
force-full: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.force_full == true) }}
analyze:
name: CodeQL
needs: changes
if: |
github.event_name == 'schedule' ||
needs.changes.outputs.run_go == 'true' ||
needs.changes.outputs.run_security == 'true'
permissions:
security-events: write
contents: read
actions: read
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# Go + Python deployable services (services/embedder, future services/memory).
language: [go, python]
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- uses: ./.github/actions/setup-buf
- name: Generate protobuf stubs for CodeQL
working-directory: packages/proto
run: buf generate
- name: Initialize CodeQL
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
category: /language:${{ matrix.language }}