mirror of
https://github.com/elgohr/Publish-Docker-Github-Action.git
synced 2026-03-12 18:07:12 -04:00
Automatically lowercasing registry and image name (#86)
* make name lowercase * Calling toLower * fixed typo in lowercase method * Also lowering registry input * Update test.bats Adapted tests * Fixed last Upercases * Linting Co-authored-by: Lars Gohr <larsgohr@posteo.de>
This commit is contained in:
@@ -9,11 +9,14 @@ main() {
|
||||
echo "::add-mask::${INPUT_PASSWORD}"
|
||||
set -x
|
||||
fi
|
||||
|
||||
|
||||
sanitize "${INPUT_NAME}" "name"
|
||||
sanitize "${INPUT_USERNAME}" "username"
|
||||
sanitize "${INPUT_PASSWORD}" "password"
|
||||
|
||||
registryToLower
|
||||
nameToLower
|
||||
|
||||
REGISTRY_NO_PROTOCOL=$(echo "${INPUT_REGISTRY}" | sed -e 's/^https:\/\///g')
|
||||
if uses "${INPUT_REGISTRY}" && ! isPartOfTheName "${REGISTRY_NO_PROTOCOL}"; then
|
||||
INPUT_NAME="${REGISTRY_NO_PROTOCOL}/${INPUT_NAME}"
|
||||
@@ -68,6 +71,14 @@ sanitize() {
|
||||
fi
|
||||
}
|
||||
|
||||
registryToLower(){
|
||||
INPUT_REGISTRY=$(echo "${INPUT_REGISTRY}" | tr '[A-Z]' '[a-z]')
|
||||
}
|
||||
|
||||
nameToLower(){
|
||||
INPUT_NAME=$(echo "${INPUT_NAME}" | tr '[A-Z]' '[a-z]')
|
||||
}
|
||||
|
||||
isPartOfTheName() {
|
||||
[ $(echo "${INPUT_NAME}" | sed -e "s/${1}//g") != "${INPUT_NAME}" ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user