Skip to content

Commit dd6b632

Browse files
authored
Merge pull request #4252 from camilamacedo86/add-codeql-sec
🌱 Add GitHub workflow to scan project with CodeQL
2 parents fd86838 + d4ddf42 commit dd6b632

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/codeql.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
# We are checking both `master` and `book-v4` branches:
5+
# - `master` represents the latest development work.
6+
# - `book-v4` is the latest stable release branch, which contains the latest published code,
7+
# ensuring that any issues in production are identified and addressed promptly.
8+
push:
9+
branches: ["master", "book-v4"]
10+
pull_request:
11+
branches: ["master", "book-v4"]
12+
schedule:
13+
- cron: '30 20 * * 1' # Runs every Monday at 8:30 PM
14+
15+
jobs:
16+
analyze:
17+
name: Analyze Go
18+
runs-on: ubuntu-latest
19+
permissions:
20+
security-events: write
21+
packages: read
22+
actions: read
23+
contents: read
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Go
30+
uses: actions/setup-go@v4
31+
with:
32+
go-version: '1.22'
33+
34+
- name: Build and install Kubebuilder CLI
35+
run: make install
36+
37+
# Preparing the project-v4 sample for CodeQL analysis:
38+
# - `go mod tidy` ensures dependencies are fully resolved.
39+
# - `make manifests` generates required manifests for a complete project structure.
40+
# - `make build` builds the project code, ensuring all components are ready for CodeQL analysis.
41+
- name: Build project-v4 sample project
42+
run: |
43+
cd testdata/project-v4
44+
go mod tidy
45+
echo 'Running build commands for Go in project-v4'
46+
make manifests
47+
make build
48+
49+
- name: Initialize CodeQL
50+
uses: github/codeql-action/init@v3
51+
with:
52+
languages: go
53+
build-mode: autobuild
54+
55+
- name: Perform CodeQL Analysis
56+
uses: github/codeql-action/analyze@v3
57+
with:
58+
category: "/language:go"

0 commit comments

Comments
 (0)