Skip to content

Commit

Permalink
TOFIX: codeql
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Lezar <[email protected]>
  • Loading branch information
elezar committed Feb 12, 2025
1 parent eeb795e commit 878982f
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions .github/workflows/code_scanning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,45 @@ on:
workflow_call:
inputs:
golang_version:
required: true
required: false
type: string
pull_request:
types:
- opened
- synchronize
branches:
- main
- release-*


jobs:
# TODO: Is there a way that we can only invoke this if this is a PR?
optionalVariables:
if: ${{ inputs.golang_version == '' }}
uses: ./.github/workflows/variables.yaml

variables:
runs-on: ubuntu-latest
needs: optionalVariables
if: always()
outputs:
golang_version: ${{ steps.golang_output.outputs.golang_version }}
steps:
- name: Check out code
if: ${{ inputs.golang_version == '' }}
uses: actions/checkout@v4
- id: golang_version
run: |
if [[ "${{ inputs.golang_version}}" != "" ]]; then
GOLANG_VERSION="${{ inputs.golang_version}}"
else
GOLANG_VERSION=$(./hack/golang-version.sh)
fi
echo "golang_version=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_OUTPUT
analyze:
needs:
- variables
name: Analyze Go code with CodeQL
runs-on: ubuntu-latest
timeout-minutes: 360
Expand All @@ -32,18 +66,22 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.golang_version }}
go-version: ${{ needs.variables.outputs.golang_version }}

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
build-mode: manual

- shell: bash
run: |
make build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
Expand Down

0 comments on commit 878982f

Please sign in to comment.