File tree Expand file tree Collapse file tree 1 file changed +40
-2
lines changed Expand file tree Collapse file tree 1 file changed +40
-2
lines changed Original file line number Diff line number Diff line change 1818 workflow_call :
1919 inputs :
2020 golang_version :
21- required : true
21+ required : false
2222 type : string
23+ pull_request :
24+ types :
25+ - opened
26+ - synchronize
27+ branches :
28+ - main
29+ - release-*
30+
2331
2432jobs :
33+ # TODO: Is there a way that we can only invoke this if this is a PR?
34+ optionalVariables :
35+ if : ${{ inputs.golang_version == "" }}
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 : ${{ inputs.golang_version == "" }}
47+ uses : actions/checkout@v4
48+ - id : golang_version
49+ run : |
50+ if [[ "${{ inputs.golang_version}}" != "" ]]; then
51+ GOLANG_VERSION="${{ inputs.golang_version}}"
52+ else
53+ GOLANG_VERSION=$(./hack/golang-version.sh)
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 :
You can’t perform that action at this time.
0 commit comments