Skip to content

🌱 Add GitHub workflow to scan project with CodeQL #3

🌱 Add GitHub workflow to scan project with CodeQL

🌱 Add GitHub workflow to scan project with CodeQL #3

Workflow file for this run

name: "CodeQL Advanced"
on:
# We are checking master and book-v4 because book-v4 has always the code
# from the latest release
push:
branches: ["master", "book-v4"]
pull_request:
branches: ["master", "book-v4"]
schedule:
- cron: '30 20 * * 1' # Runs a periodic scan every Monday at 8:30 PM
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
security-events: write
packages: read
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: go
build-mode: autobuild
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Install Kubebuilder tools
run: |
go install sigs.k8s.io/controller-tools/cmd/[email protected]
go install sigs.k8s.io/kustomize/kustomize/[email protected]
- name: Build and install Kubebuilder CLI
run: make install
# Construa apenas o projeto project-v4 no diretório testdata
- name: Build project-v4 sample project
run: |
cd testdata/project-v4
go mod tidy
make all
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- if: matrix.language == 'go' && matrix.build-mode == 'manual'
shell: bash
run: |
cd testdata/project-v4
go mod tidy
echo 'Running manual build commands for Go in project-v4'
make manifests
make build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"