Skip to content

Commit bf09b93

Browse files
authored
chore: codeql advanced go config (#4305)
1 parent e4ccf0b commit bf09b93

2 files changed

Lines changed: 148 additions & 0 deletions

File tree

.github/workflows/codeql-go.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CodeQL Go
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
paths:
7+
- "**/*.go"
8+
- "go.mod"
9+
- "go.sum"
10+
- "flake.*"
11+
- "Makefile"
12+
- ".github/workflows/codeql-go.yaml"
13+
push:
14+
branches: [main]
15+
paths:
16+
- "**/*.go"
17+
- "go.mod"
18+
- "go.sum"
19+
- "flake.*"
20+
- "Makefile"
21+
- ".github/workflows/codeql-go.yaml"
22+
schedule:
23+
- cron: "30 2 * * 1"
24+
workflow_dispatch:
25+
26+
permissions:
27+
contents: read
28+
security-events: write
29+
packages: read
30+
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.ref }}
33+
cancel-in-progress: true
34+
35+
jobs:
36+
analyze-go:
37+
name: Analyze Go
38+
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
39+
runs-on: depot-ubuntu-latest-16
40+
timeout-minutes: 60
41+
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45+
with:
46+
persist-credentials: false
47+
48+
- name: Set up Go
49+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
50+
with:
51+
go-version-file: go.mod
52+
cache: true
53+
54+
- name: Initialize CodeQL
55+
uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
56+
with:
57+
languages: go
58+
build-mode: manual
59+
dependency-caching: false
60+
61+
- name: Build backend for CodeQL (PRs only)
62+
if: ${{ github.event_name == 'pull_request' }}
63+
run: |
64+
make build-server GO_BUILD_FLAGS=
65+
66+
- name: Full build report for CodeQL (non-PRs only)
67+
if: ${{ github.event_name != 'pull_request' }}
68+
run: |
69+
make build GO_BUILD_FLAGS=
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
73+
with:
74+
category: "/language:go"

.github/workflows/codeql.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CodeQL
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
paths:
7+
- ".github/**"
8+
- "**/*.js"
9+
- "**/*.jsx"
10+
- "**/*.ts"
11+
- "**/*.tsx"
12+
- "**/*.py"
13+
- "api/client/javascript/**"
14+
- "api/client/python/**"
15+
- "api/spec/**"
16+
- "package.json"
17+
- "pnpm-lock.yaml"
18+
- ".github/workflows/codeql.yml"
19+
push:
20+
branches: [main]
21+
paths:
22+
- ".github/**"
23+
- "**/*.js"
24+
- "**/*.jsx"
25+
- "**/*.ts"
26+
- "**/*.tsx"
27+
- "**/*.py"
28+
- "api/client/javascript/**"
29+
- "api/client/python/**"
30+
- "api/spec/**"
31+
- "package.json"
32+
- "pnpm-lock.yaml"
33+
- ".github/workflows/codeql.yml"
34+
schedule:
35+
- cron: "32 3 * * 0"
36+
workflow_dispatch:
37+
38+
permissions:
39+
contents: read
40+
security-events: write
41+
packages: read
42+
43+
concurrency:
44+
group: ${{ github.workflow }}-${{ github.ref }}
45+
cancel-in-progress: true
46+
47+
jobs:
48+
analyze:
49+
name: Analyze (${{ matrix.language }})
50+
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
51+
runs-on: depot-ubuntu-latest-4
52+
timeout-minutes: 30
53+
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
language: [actions, javascript-typescript, python]
58+
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
62+
with:
63+
persist-credentials: false
64+
65+
- name: Initialize CodeQL
66+
uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
67+
with:
68+
languages: ${{ matrix.language }}
69+
build-mode: none
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
73+
with:
74+
category: "/language:${{ matrix.language }}"

0 commit comments

Comments
 (0)