workflows: fix validate CRD by fetching all git repo history #6621
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: codeql | |
on: | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
schedule: | |
- cron: "45 6 * * 3" | |
permissions: read-all | |
jobs: | |
check_changes: | |
name: Deduce required tests from code changes | |
if: ${{ github.event_name == 'pull_request' }} | |
runs-on: ubuntu-22.04 | |
outputs: | |
go-changes: ${{ steps.go-changes.outputs.src }} | |
steps: | |
- name: Checkout code | |
if: ${{ !github.event.pull_request }} | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
- name: Check code changes | |
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0 | |
id: go-changes | |
with: | |
base: ${{ github.event.pull_request.base.sha }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
filters: | | |
src: | |
- .github/workflows/lint-codeql.yaml | |
- '**/*.go' | |
- 'go.mod' | |
- 'go.sum' | |
analyze: | |
needs: check_changes | |
if: ${{ needs.check_changes.outputs.go-changes == 'true' || github.event_name != 'pull_request' }} | |
runs-on: ubuntu-22.04 | |
permissions: | |
security-events: write | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
fetch-depth: 1 | |
- name: Install Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
# renovate: datasource=golang-version depName=go | |
go-version: '1.21.6' | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 | |
with: | |
languages: go | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 |