Check booleans for falseness

This commit is contained in:
Lars Gohr
2019-11-14 20:18:40 +01:00
parent 76854f3a3e
commit e8f33163ce
2 changed files with 54 additions and 4 deletions

View File

@@ -30,11 +30,11 @@ function main() {
if uses "${INPUT_BUILDARGS}"; then
addBuildArgs
fi
if uses "${INPUT_CACHE}"; then
if usesBoolean "${INPUT_CACHE}"; then
useBuildCache
fi
if uses "${INPUT_SNAPSHOT}"; then
if usesBoolean "${INPUT_SNAPSHOT}"; then
pushWithSnapshot
else
pushWithoutSnapshot
@@ -62,7 +62,7 @@ function translateDockerTag() {
INPUT_NAME=$(echo ${INPUT_NAME} | cut -d':' -f1)
elif isOnMaster; then
TAG="latest"
elif isGitTag && uses "${INPUT_TAG_NAMES}"; then
elif isGitTag && usesBoolean "${INPUT_TAG_NAMES}"; then
TAG=$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g")
elif isGitTag; then
TAG="latest"
@@ -114,6 +114,10 @@ function uses() {
[ ! -z "${1}" ]
}
function usesBoolean() {
[ ! -z "${1}" ] && [ "${1}" = "true" ]
}
function pushWithSnapshot() {
local TIMESTAMP=`date +%Y%m%d%H%M%S`
local SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-6)