name: CodeQL on: push: branches: [main] pull_request: branches: [main] schedule: # Weekly on Monday 03:27 UTC — off-peak and offset from the other # scheduled jobs (scorecard 06:00 Mon, labels 04:17 Mon, stale 04:37 # daily). - cron: '27 3 * * 1' # Default to read-only; the analyze job opts into security-events: write. permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: analyze: name: Analyze (${{ matrix.language }}) runs-on: ubuntu-latest timeout-minutes: 120 permissions: # Upload CodeQL results to the code-scanning dashboard. security-events: write # Check out the repository. contents: read # Read workflow run metadata (required by codeql-action on private # repos; harmless on a public repo). actions: read strategy: fail-fast: false matrix: include: # Go only supports "autobuild" or "manual" (not "none"). autobuild # discovers every go.mod in the tree and extracts each module # separately (the root module, api/apps/v1alpha1, and the three # nested image modules that `go build ./...` from the root never # reaches), so coverage is broader than a single root build. It first # attempts `make` from the repo root — which runs the default Makefile # goal, including a network `git fetch upstream --tags` — before # falling back to the Go build. setup-go below pins the toolchain to # the go.mod version so autobuild does not use whatever Go the runner # ships. - language: go build-mode: autobuild steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: go-version-file: go.mod cache: false - name: Initialize CodeQL uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 with: category: "/language:${{ matrix.language }}"