mirror of
https://github.com/ibiqlik/action-yamllint.git
synced 2024-11-21 22:00:57 -05:00
Add default values, exit if no input
This commit is contained in:
parent
9ea81d4a61
commit
00803810a2
3 changed files with 17 additions and 9 deletions
10
README.md
10
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
|
||||
```
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue