karancode / kustomize-github-action

:european_castle: Github action for kustomize
https://github.com/marketplace/actions/kustomize-github-action
MIT License
46 stars 29 forks source link

fix: handle non provided kustomize_output_file #32

Closed tanguyantoine closed 3 years ago

tanguyantoine commented 3 years ago

without quotes, the statement is evaluated as true

Details of Change

Surround variable with quotes

Issue

kustomize_output_file is optional, not providing it results in a failing job

Test Results

I created this script (it replicates the current implementation) and added quotes

kustomize_output_file=""
if [ -n "${INPUT_KUSTOMIZE_OUTPUT_FILE}" ]; then
  kustomize_output_file=${INPUT_KUSTOMIZE_OUTPUT_FILE}
fi

echo $kustomize_output_file

if [ -n "${kustomize_output_file}" ]; then
  echo "build: writing output to ${kustomize_output_file}"
fi
INPUT_KUSTOMIZE_OUTPUT_FILE="ok" sh script.sh
ok
build: writing output to ok
sh script.sh
karancode commented 3 years ago

Thank you @tanguyantoine for the fix. It is release in v1.2.3. 🎉 🙇🏼

tanguyantoine commented 3 years ago

lovely