From acd2f553eaf8ae68829189765331cc6fbc4494b1 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Mon, 16 Dec 2024 10:55:16 -0800 Subject: [PATCH] fix: install toolchain version if it exists --- .github/actions/setup-go/action.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml index ddd4e28e461..2ec5a014c3c 100644 --- a/.github/actions/setup-go/action.yml +++ b/.github/actions/setup-go/action.yml @@ -29,10 +29,21 @@ inputs: runs: using: composite steps: + - name: Get Go Version + 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