Repository navigation
82 lines (73 loc) · 2.62 KB
/
Copy pathcodeql.yml
File metadata and controls
82 lines (73 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
---
# CodeQL static analysis for the Go source and for the GitHub
# Actions workflows themselves. Runs on every pull request, every
# push to `main`, and weekly so the analysis re-evaluates `main`
# against newly published query updates even when nothing in the
# tree changed. Results upload to the repository's code-scanning
# dashboard as SARIF.
#
# Two languages analyze in parallel matrix slots. `go` builds with
# CodeQL autobuild; the vendored module graph lets `go build ./...`
# resolve without network fetches. `actions` scans the workflow
# files with no build step. Both run the `security-extended` query
# suite, which widens the security ruleset without pulling in the
# code-quality queries that would overlap golangci-lint.
name: codeql
on:
push:
branches: [main]
pull_request:
schedule:
# Weekly, Sunday 03:39 UTC. Off-peak and off the top of the hour
# so the run avoids the busiest scheduler slots.
- cron: "39 3 * * 0"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
analyze:
name: "analyze (${{ matrix.language }})"
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
contents: read
security-events: write
actions: read
packages: read
strategy:
fail-fast: false
matrix:
include:
- language: go
build-mode: autobuild
- language: actions
build-mode: none
steps:
- name: Harden the runner
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Pin the Go toolchain to the version in go.mod so autobuild
# builds with it instead of the CodeQL bundle's older Go.
- name: Set up Go
if: matrix.language == 'go'
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
check-latest: false
- name: Initialize CodeQL
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
queries: security-extended
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
category: "/language:${{ matrix.language }}"