yamllint/entrypoint.sh

36 lines
722 B
Bash
Raw Normal View History

#!/bin/bash -l
2019-10-16 10:43:28 +02:00
echo "======================"
echo "= Linting YAML files ="
echo "======================"
2021-08-10 19:47:03 +02:00
LOGFILE=yamllint.log
if [[ -n "$INPUT_CONFIG_FILE" ]]; then
options+=(-c "$INPUT_CONFIG_FILE")
2019-10-16 10:43:28 +02:00
fi
if [[ -n "$INPUT_CONFIG_DATA" ]]; then
options+=(-d "$INPUT_CONFIG_DATA")
fi
options+=(-f "$INPUT_FORMAT")
if [[ "$INPUT_STRICT" == "true" ]]; then
options+=(-s)
fi
2021-05-26 08:56:08 +02:00
if [[ "$INPUT_NO_WARNINGS" == "true" ]]; then
options+=(--no-warnings)
fi
# Enable globstar so ** globs recursively
shopt -s globstar
# Use the current directory by default
2020-11-08 18:54:33 +01:00
options+=("${INPUT_FILE_OR_DIR:-.}")
shopt -u globstar
2021-08-10 19:47:03 +02:00
yamllint "${options[@]}" | tee -a $LOGFILE
echo "::set-output name=logfile::$(realpath ${LOGFILE})"