diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..32e0831 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3-alpine + +RUN pip install yamllint && \ + rm -rf ~/.cache/pip + +ADD entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..60d7147 --- /dev/null +++ b/action.yml @@ -0,0 +1,24 @@ +name: 'YAMLLint' +description: 'Validate YAML syntax' +author: 'ibiqlik' + +inputs: + file_or_dir: + description: 'File(s) or Directory' + required: true + config_file: + description: 'Path to custom configuration' + required: false + config_data: + description: 'Custom configuration (as YAML source)' + required: false + format: + description: 'Format for parsing output [parsable,standard]' + required: false + strict: + description: 'Return non-zero exit code on warnings as well as errors' + required: false + +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..c424ae4 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh -l + +if [ ! -z $INPUT_STRICT ]; then + STRICT="-s" +fi + +yamllint $INPUT_CONFIG_FILE $INPUT_CONFIG_DATA $INPUT_FORMAT $STRICT $INPUT_FILE_OR_DIR