Skip to content

Commit

Permalink
fix: go-version-file path (#2672)
Browse files Browse the repository at this point in the history
blocked on
#2682
closes
#2661

---------

Signed-off-by: laurentsimon <laurentsimon@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>
Co-authored-by: Ian Lewis <ianlewis@google.com>
  • Loading branch information
laurentsimon and ianlewis committed Sep 5, 2023
1 parent ad77c9f commit 00c744f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/actions/secure-project-checkout-go/action.yml
Expand Up @@ -44,19 +44,28 @@ runs:
path: ${{ inputs.path }}

- name: Validate Go version.
id: validate
shell: bash
env:
GO_VERSION: ${{ inputs.go-version }}
GO_VERSION_FILE: ${{ inputs.go-version-file }}
INPUT_PATH: ${{ inputs.path }}
run: |
set -euo pipefail
if [ "${GO_VERSION}" == "" ] && [ "${GO_VERSION_FILE}" == "" ]; then
echo "::error::One of go-version or go-version-file should be specified."
exit 1
fi
if [ "${GO_VERSION}" != "" ]; then
echo "go_version=${GO_VERSION}" >> "$GITHUB_OUTPUT"
fi
if [ "${GO_VERSION_FILE}" != "" ]; then
# NOTE: We use realpath to remove the trailing '/' if present.
echo "go_version_file=${INPUT_PATH%%/}/${GO_VERSION_FILE}" >> "$GITHUB_OUTPUT"
fi
- name: Set up Go environment
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ inputs.go-version }}
go-version-file: ${{ inputs.go-version-file }}
go-version: ${{ steps.validate.outputs.go_version }}
go-version-file: ${{ steps.validate.outputs.go_version_file }}

0 comments on commit 00c744f

Please sign in to comment.