# This action sets GO_VERSION from the project's go.mod.
#
# Must be run after actions/checkout to ensure go.mod is available to
# source the project's go version from.

name: 'Set GO_VERSION env var from go.mod'
description: 'Read the go version from go.mod and add it as env var GO_VERSION in the github env'

runs:
  using: composite
  steps:
    - name: Set the project Go version in the environment
      # A script works across different platforms but attempting to replicate the script directly in
      # the run statement runs into platform-specific path handling issues.
      run: .github/actions/set-go-version-in-env/go_version_env.sh >> $GITHUB_ENV
      shell: bash
    - name: Set GOPRIVATE for luxfi packages
      # Some luxfi packages have large zip files that exceed Go proxy limits
      run: |
        echo "GOPRIVATE=github.com/luxfi/*" >> $GITHUB_ENV
        echo "GONOSUMDB=github.com/luxfi/*" >> $GITHUB_ENV
      shell: bash
