name: "Get Build Options"
description: "Sanitizies and unifies the environment into build options"
outputs:
  short-sha:
    description: "Shortened hash if the current commit"
  build-arch:
    description: "Docker-compatible representation of build arch"
  build-platform:
    description: "Docker-compatible representation of build platform"
runs:
  using: "composite"
  steps:
    - name: "Compute Build Options"
      shell: "bash"
      run: |
        set -x
        SHORT_SHA="${GITHUB_SHA::8}"
        BUILD_ARCH="amd64"
        BUILD_PLATFORM="linux/amd64"
        if [ "${RUNNER_ARCH}" = "ARM64" ];then
          BUILD_ARCH="arm64"
          BUILD_PLATFORM="linux/arm64"
        fi
        echo "short-sha=$SHORT_SHA" >> $GITHUB_OUTPUT
        echo "build-arch=$BUILD_ARCH" >> $GITHUB_OUTPUT
        echo "build-platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT
