diff --git a/read-action-input b/read-action-input index ff36b15..67c71c2 100755 --- a/read-action-input +++ b/read-action-input @@ -1,13 +1,11 @@ -#!/usr/bin/env node -// helper script for printing kebab-cased env vars. -// e.g., "foo-bar" -> "INPUT_FOO-BAR". -// -// This does not need to be implemented in nodejs, -// but reimplementing this in sh is hard. +#!/usr/bin/env bash +# helper script for printing kebab-cased env vars. +# e.g., "foo-bar" -> "INPUT_FOO-BAR". +set -eu -o pipefail -const arg = process.argv[2]; // Equates to "$1" in sh -const k = "INPUT_" + arg.toUpperCase(); -const v = process.env[k]; -if ( v !== undefined ) { - console.log(v); -} +arg=INPUT_${1^^} +while IFS= read -r -d '' var; do + [[ $var = "$arg"=* ]] || continue + echo "${var#"${arg}="}" + break +done