diff --git a/README.md b/README.md index 371be34..a81a1e8 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,15 @@ This action executes `yamllint` (https://github.com/adrienverge/yamllint) agains - `file_or_dir` - Enter file/folder (space speparated), wildcards accepted. Examples: - `file1.yaml` - `file1.yaml file2.yaml` - - `.` - run against all yaml files in current directory recursively - - `./**/*values.yaml` - run against all files that end with `values.yaml` recursively + - `.` - run against all yaml files in a directory recursively + - `kustomize/**/*.yaml mychart/*values.yaml` ### Optional parameters - `config_file` - Path to custom configuration - `config_data` - Custom configuration (as YAML source) -- `format` - Format for parsing output [parsable,standard] -- `strict` - Return non-zero exit code on warnings as well as errors +- `format` - Format for parsing output [parsable,standard,colored,auto] +- `strict` - Return non-zero exit code on warnings as well as errors [true,false] ### Example usage in workflow @@ -32,6 +32,6 @@ jobs: - name: yaml-lint uses: ibiqlik/action-yamllint@master with: - file_or_dir: ./**/*val*.yaml + file_or_dir: myfolder/*values*.yaml config_file: .yamllint.yml ``` diff --git a/action.yml b/action.yml index 3f9bb5a..4c816a8 100644 --- a/action.yml +++ b/action.yml @@ -4,7 +4,7 @@ author: 'ibiqlik' inputs: file_or_dir: - description: 'File(s) or Directory' + description: 'File(s) or Directory, separate by space if multiple files or folder are specified' required: true config_file: description: 'Path to custom configuration' @@ -13,11 +13,13 @@ inputs: description: 'Custom configuration (as YAML source)' required: false format: - description: 'Format for parsing output [parsable,standard]' + description: 'Format for parsing output [parsable,standard,colored,auto]' required: false + default: "auto" strict: description: 'Return non-zero exit code on warnings as well as errors' required: false + default: "false" runs: using: 'docker' diff --git a/entrypoint.sh b/entrypoint.sh index 12e63c4..359949c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,7 +4,13 @@ echo "======================" echo "= Linting YAML files =" echo "======================" -if [ ! -z "$INPUT_STRICT" ]; then +if [ -z "INPUT_FILE_OR_DIR" ]; then + echo "file_or_dir not provided, add it in workflow" + exit 1 +fi + +STRICT="" +if [ "$INPUT_STRICT" == "true" ]; then STRICT="-s" fi @@ -16,4 +22,4 @@ if [ ! -z "$INPUT_CONFIG_DATA" ]; then CONFIG_DATA="-d $INPUT_CONFIG_DATA" fi -yamllint $CONFIG_FILE $CONFIG_DATA $INPUT_FORMAT $STRICT $INPUT_FILE_OR_DIR +yamllint $CONFIG_FILE $CONFIG_DATA -f $INPUT_FORMAT $STRICT $INPUT_FILE_OR_DIR