Skip to content

Commit 42f34f4

Browse files
committed
TOFIX: codeql
Signed-off-by: Evan Lezar <[email protected]>
1 parent eeb795e commit 42f34f4

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

.github/workflows/code_scanning.yaml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,43 @@ on:
2020
golang_version:
2121
required: true
2222
type: string
23+
pull_request:
24+
types:
25+
- opened
26+
- synchronize
27+
branches:
28+
- main
29+
- release-*
30+
2331

2432
jobs:
33+
# TODO: Is there a way that we can only invoke this if this is a PR?
34+
optionalVariables:
35+
if: ${{ github.event_name == 'pull_request' }}
36+
uses: ./.github/workflows/variables.yaml
37+
38+
variables:
39+
runs-on: ubuntu-latest
40+
needs: optionalVariables
41+
if: always()
42+
outputs:
43+
golang_version: ${{ steps.golang_output.outputs.golang_version }}
44+
steps:
45+
- name: Check out code
46+
if: ${{ github.event_name == 'pull_request' }}
47+
uses: actions/checkout@v4
48+
- id: golang_version
49+
run: |
50+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
51+
GOLANG_VERSION=$(./hack/golang-version.sh)
52+
else
53+
GOLANG_VERSION="${{ inputs.golang_version}}"
54+
fi
55+
echo "golang_version=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_OUTPUT
56+
2557
analyze:
58+
needs:
59+
- variables
2660
name: Analyze Go code with CodeQL
2761
runs-on: ubuntu-latest
2862
timeout-minutes: 360
@@ -32,18 +66,22 @@ jobs:
3266
steps:
3367
- name: Checkout repository
3468
uses: actions/checkout@v4
69+
3570
- name: Install Go
3671
uses: actions/setup-go@v5
3772
with:
38-
go-version: ${{ inputs.golang_version }}
73+
go-version: ${{ needs.variables.outputs.golang_version }}
74+
3975
- name: Initialize CodeQL
4076
uses: github/codeql-action/init@v3
4177
with:
4278
languages: go
4379
build-mode: manual
80+
4481
- shell: bash
4582
run: |
4683
make build
84+
4785
- name: Perform CodeQL Analysis
4886
uses: github/codeql-action/analyze@v3
4987
with:

0 commit comments

Comments
 (0)