2020-02-18 03:02:36 +01:00
|
|
|
#!/bin/bash -l
|
2019-10-16 10:43:28 +02:00
|
|
|
|
2019-12-17 12:50:34 +01:00
|
|
|
echo "======================"
|
|
|
|
echo "= Linting YAML files ="
|
|
|
|
echo "======================"
|
|
|
|
|
2020-02-18 03:02:36 +01:00
|
|
|
if [[ -n "$INPUT_CONFIG_FILE" ]]; then
|
|
|
|
options+=(-c "$INPUT_CONFIG_FILE")
|
2019-10-16 10:43:28 +02:00
|
|
|
fi
|
|
|
|
|
2020-02-18 03:02:36 +01:00
|
|
|
if [[ -n "$INPUT_CONFIG_DATA" ]]; then
|
|
|
|
options+=(-d "$INPUT_CONFIG_DATA")
|
2019-10-16 10:47:45 +02:00
|
|
|
fi
|
|
|
|
|
2020-02-18 03:02:36 +01:00
|
|
|
options+=(-f "$INPUT_FORMAT")
|
|
|
|
|
|
|
|
if [[ "$INPUT_STRICT" == "true" ]]; then
|
|
|
|
options+=(-s)
|
2019-10-16 10:47:45 +02:00
|
|
|
fi
|
|
|
|
|
2021-05-26 08:56:08 +02:00
|
|
|
if [[ "$INPUT_NO_WARNINGS" == "true" ]]; then
|
|
|
|
options+=(--no-warnings)
|
|
|
|
fi
|
|
|
|
|
2020-02-18 03:02:36 +01:00
|
|
|
# Enable globstar so ** globs recursively
|
|
|
|
shopt -s globstar
|
|
|
|
|
2021-08-18 15:23:29 +02:00
|
|
|
yamllint "${options[@]}" ${INPUT_FILE_OR_DIR:-.}
|
|
|
|
|
2021-08-19 18:14:17 +02:00
|
|
|
exitcode=$?
|
|
|
|
|
2021-08-18 15:23:29 +02:00
|
|
|
shopt -u globstar
|
2021-08-19 18:14:17 +02:00
|
|
|
|
|
|
|
exit $exitcode
|