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:
|
- `file_or_dir` - Enter file/folder (space speparated), wildcards accepted. Examples:
|
||||||
- `file1.yaml`
|
- `file1.yaml`
|
||||||
- `file1.yaml file2.yaml`
|
- `file1.yaml file2.yaml`
|
||||||
- `.` - run against all yaml files in current directory recursively
|
- `.` - run against all yaml files in a directory recursively
|
||||||
- `./**/*values.yaml` - run against all files that end with `values.yaml` recursively
|
- `kustomize/**/*.yaml mychart/*values.yaml`
|
||||||
|
|
||||||
### Optional parameters
|
### Optional parameters
|
||||||
|
|
||||||
- `config_file` - Path to custom configuration
|
- `config_file` - Path to custom configuration
|
||||||
- `config_data` - Custom configuration (as YAML source)
|
- `config_data` - Custom configuration (as YAML source)
|
||||||
- `format` - Format for parsing output [parsable,standard]
|
- `format` - Format for parsing output [parsable,standard,colored,auto]
|
||||||
- `strict` - Return non-zero exit code on warnings as well as errors
|
- `strict` - Return non-zero exit code on warnings as well as errors [true,false]
|
||||||
|
|
||||||
### Example usage in workflow
|
### Example usage in workflow
|
||||||
|
|
||||||
|
@ -32,6 +32,6 @@ jobs:
|
||||||
- name: yaml-lint
|
- name: yaml-lint
|
||||||
uses: ibiqlik/action-yamllint@master
|
uses: ibiqlik/action-yamllint@master
|
||||||
with:
|
with:
|
||||||
file_or_dir: ./**/*val*.yaml
|
file_or_dir: myfolder/*values*.yaml
|
||||||
config_file: .yamllint.yml
|
config_file: .yamllint.yml
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,7 +4,7 @@ author: 'ibiqlik'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
file_or_dir:
|
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
|
required: true
|
||||||
config_file:
|
config_file:
|
||||||
description: 'Path to custom configuration'
|
description: 'Path to custom configuration'
|
||||||
|
@ -13,11 +13,13 @@ inputs:
|
||||||
description: 'Custom configuration (as YAML source)'
|
description: 'Custom configuration (as YAML source)'
|
||||||
required: false
|
required: false
|
||||||
format:
|
format:
|
||||||
description: 'Format for parsing output [parsable,standard]'
|
description: 'Format for parsing output [parsable,standard,colored,auto]'
|
||||||
required: false
|
required: false
|
||||||
|
default: "auto"
|
||||||
strict:
|
strict:
|
||||||
description: 'Return non-zero exit code on warnings as well as errors'
|
description: 'Return non-zero exit code on warnings as well as errors'
|
||||||
required: false
|
required: false
|
||||||
|
default: "false"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
|
|
|
@ -4,7 +4,13 @@ echo "======================"
|
||||||
echo "= Linting YAML files ="
|
echo "= Linting YAML files ="
|
||||||
echo "======================"
|
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"
|
STRICT="-s"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -16,4 +22,4 @@ if [ ! -z "$INPUT_CONFIG_DATA" ]; then
|
||||||
CONFIG_DATA="-d $INPUT_CONFIG_DATA"
|
CONFIG_DATA="-d $INPUT_CONFIG_DATA"
|
||||||
fi
|
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