From db8f332c96347bbaf9c4e66b25af842bd7365b33 Mon Sep 17 00:00:00 2001 From: Ilir Bekteshi Date: Wed, 16 Oct 2019 10:43:28 +0200 Subject: [PATCH] Add action, dockerfile, entrypoint --- Dockerfile | 8 ++++++++ action.yml | 24 ++++++++++++++++++++++++ entrypoint.sh | 7 +++++++ 3 files changed, 39 insertions(+) create mode 100644 Dockerfile create mode 100644 action.yml create mode 100644 entrypoint.sh 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