From edea218783c88cd7dbaa2be8ec9e1c814cfb0b6f Mon Sep 17 00:00:00 2001 From: Alex Viscreanu Date: Fri, 19 Jun 2020 13:14:45 +0200 Subject: [PATCH] chore: Rename function to ensure variables being set --- entrypoint.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index ddfa1d8..6aa1bce 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,18 +11,18 @@ export USERNAME=${INPUT_USERNAME:-$GITHUB_ACTOR} export PASSWORD=${INPUT_PASSWORD:-$GITHUB_TOKEN} export IMAGE=$IMAGE:$TAG -function sanitize() { +function ensure() { if [ -z "${1}" ]; then - echo >&2 "Unable to find the ${2}. Did you set with.${2}?" + echo >&2 "Unable to find the ${2} variable. Did you set with.${2}?" exit 1 fi } -sanitize "${REGISTRY}" "registry" -sanitize "${USERNAME}" "username" -sanitize "${PASSWORD}" "password" -sanitize "${IMAGE}" "image" -sanitize "${TAG}" "tag" +ensure "${REGISTRY}" "registry" +ensure "${USERNAME}" "username" +ensure "${PASSWORD}" "password" +ensure "${IMAGE}" "image" +ensure "${TAG}" "tag" if [ "$REGISTRY" == "docker.pkg.github.com" ]; then IMAGE_NAMESPACE="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"