File tree Expand file tree Collapse file tree 1 file changed +41
-2
lines changed Expand file tree Collapse file tree 1 file changed +41
-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+ default : " "
24+ pull_request :
25+ types :
26+ - opened
27+ - synchronize
28+ branches :
29+ - main
30+ - release-*
31+
2332
2433jobs :
34+ # TODO: Is there a way that we can only invoke this if this is a PR?
35+ optionalVariables :
36+ if : ${{ inputs.golang_verion == "" }}
37+ uses : ./.github/workflows/variables.yaml
38+
39+ variables :
40+ runs-on : ubuntu-latest
41+ needs : optionalVariables
42+ if : always()
43+ outputs :
44+ golang_version : ${{ steps.golang_output.outputs.golang_version }}
45+ steps :
46+ - name : Check out code
47+ if : ${{ inputs.golang_verion == "" }}
48+ uses : actions/checkout@v4
49+ - id : golang_version
50+ run : |
51+ if [[ "${{ inputs.golang_version}}" != "" ]]; then
52+ GOLANG_VERSION="${{ inputs.golang_version}}"
53+ else
54+ GOLANG_VERSION=$(./hack/golang-version.sh)
55+ fi
56+ echo "golang_version=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_OUTPUT
57+
2558 analyze :
59+ needs :
60+ - variables
2661 name : Analyze Go code with CodeQL
2762 runs-on : ubuntu-latest
2863 timeout-minutes : 360
@@ -32,18 +67,22 @@ jobs:
3267 steps :
3368 - name : Checkout repository
3469 uses : actions/checkout@v4
70+
3571 - name : Install Go
3672 uses : actions/setup-go@v5
3773 with :
38- go-version : ${{ inputs.golang_version }}
74+ go-version : ${{ needs.variables.outputs.golang_version }}
75+
3976 - name : Initialize CodeQL
4077 uses : github/codeql-action/init@v3
4178 with :
4279 languages : go
4380 build-mode : manual
81+
4482 - shell : bash
4583 run : |
4684 make build
85+
4786 - name : Perform CodeQL Analysis
4887 uses : github/codeql-action/analyze@v3
4988 with :
You can’t perform that action at this time.
0 commit comments