From a744ed66541a3bd9b5edb2977ce5e03fa55e6356 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Tue, 17 Dec 2024 11:49:02 -0800 Subject: [PATCH] fix: install toolchain version if it exists (#15645) --- .github/actions/setup-go/action.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml index ddd4e28e461..e1b15c2b183 100644 --- a/.github/actions/setup-go/action.yml +++ b/.github/actions/setup-go/action.yml @@ -29,10 +29,22 @@ inputs: runs: using: composite steps: + - name: Get Go Version + shell: bash + id: go-version + run: | + version=$(sed -ne '/^toolchain /s/^toolchain go//p' ${{ inputs.go-version-file }}) + if [ -z "$version" ]; then + version=$(sed -ne '/^go /s/^go //p' ${{ inputs.go-version-file }}) + echo "Toolchain version not found in ${{ inputs.go-version-file }}, using go directive instead." + fi + echo "Go Version: $version" + echo "version=$version" >> "$GITHUB_OUTPUT" + - name: Set up Go uses: actions/setup-go@v5.0.2 with: - go-version-file: ${{ inputs.go-version-file }} + go-version: ${{ steps.go-version.outputs.version }} cache: false check-latest: true