yamllint/entrypoint.sh
Stephan Schnabel e9684a1ffa
Some checks failed
ci/woodpecker/push/dockerhub Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/build Pipeline failed
ci/woodpecker/push/test/2 unknown status
ci/woodpecker/push/test/1 unknown status
Initial draft of plugin.
2025-06-17 23:35:34 +02:00

41 lines
776 B
Bash
Executable file

#!/bin/bash
set -eu;
##
## check if any yaml file is present
##
FILES=$(find "$(pwd)" -type f -name '*.yml' -o -name '*.yaml')
if [[ ! "$FILES" ]]; then
echo "No yaml file found!"
exit 1
fi
##
## build command
##
COMMAND="yamllint"
if [[ -n "${PLUGIN_CONFIG_FILE:-}" ]]; then
COMMAND+=" --config-file=$PLUGIN_CONFIG"
fi
COMMAND+="--format=${PLUGIN_FORMAT:-colored}"
if [[ "${PLUGIN_STRICT:-true}" == "true" ]]; then
COMMAND+=" --strict"
fi
if [[ "${PLUGIN_NO_WARNINGS:-}" == "true" ]]; then
COMMAND+=" --no-warnings"
fi
COMMAND+=" $(pwd)"
# custom args, e.g. docker run --rm --volume=$(pwd):$(pwd) --workdir=$(pwd) --env=CI=test kokuwaio/yamllint --format=json
if [[ -n "${1:-}" ]]; then
COMMAND+=" $*"
fi
##
## execute command
##
echo "$COMMAND"
eval "$COMMAND"