fix: exit with error if missing informations 🐛

This commit is contained in:
2024-10-30 10:07:42 +13:00
parent 1f18b83405
commit 8402f345cf

View File

@@ -37,30 +37,31 @@ action_error() {
# Verify that the minimally required password settings are set for operation.
function verify_minimum_env {
if [ -z "$username" ]; then
action_warn "username is required for plugin operation"
action_warn "username is required for action operation"
fi
if [ -z "$baseurl" ]; then
action_warn "gitea_baseurl setting is required for plugin operation"
action_warn "baseurl setting is required for action operation"
fi
if [ -z "$owner" ]; then
action_warn "gitea_owner setting is required for plugin operation"
action_warn "owner setting is required for action operation"
fi
if [ -z "$access_token" ]; then
action_warn "gitea_token setting is required for plugin operation"
action_warn "access_token setting is required for action operation"
fi
if [ -z "$version" ]; then
action_warn "gitea_version setting is required for plugin operation"
action_warn "version setting is required for action operation"
fi
if [ -z "$username" ] ||
[ -z "$baseurl" ] ||
[ -z "$version" ] ||
[ -z "$access_token" ]; then
action_error <<-'EOF'
You need to specify one/all of the following settings:
- username
- access_token
- baseurl
You need to specify one/all of the following settings:
- username
- access_token
- baseurl
EOF
exit 1
fi
action_note "Sufficient configuration"
@@ -132,7 +133,6 @@ function process_upload_file {
_main() {
action_note "Starting"
env | sort
verify_minimum_env "$@"
process_upload_file "$@"
}