Use the current directory as default path for yamllint

Use the current directory as default path for yamllint.
It's a handy default option which allows yamllint to check all yaml
files in repository by default (which is usually the use case).
This commit is contained in:
Petr Ruzicka 2020-01-08 08:23:41 +01:00
parent 00803810a2
commit cf0212bc66
2 changed files with 22 additions and 13 deletions

View file

@ -4,18 +4,15 @@ This action executes `yamllint` (https://github.com/adrienverge/yamllint) agains
## Usage
### Required parameters
- `file_or_dir` - Enter file/folder (space speparated), wildcards accepted. Examples:
- `file1.yaml`
- `file1.yaml file2.yaml`
- `.` - 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)
- `file_or_dir` - Enter file/folder (space separated), wildcards accepted. Examples:
- `.` - run against all yaml files in a directory recursively (default)
- `file1.yaml`
- `file1.yaml file2.yaml`
- `kustomize/**/*.yaml mychart/*values.yaml`
- `format` - Format for parsing output [parsable,standard,colored,auto]
- `strict` - Return non-zero exit code on warnings as well as errors [true,false]
@ -35,3 +32,17 @@ jobs:
file_or_dir: myfolder/*values*.yaml
config_file: .yamllint.yml
```
Or just simply check all yaml files in the repository:
```yaml
name: Yaml Lint
on: [push]
jobs:
lintAllTheThings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: yaml-lint
uses: ibiqlik/action-yamllint@master
```

View file

@ -4,10 +4,8 @@ echo "======================"
echo "= Linting YAML files ="
echo "======================"
if [ -z "INPUT_FILE_OR_DIR" ]; then
echo "file_or_dir not provided, add it in workflow"
exit 1
fi
# Use the current directory by default
export INPUT_FILE_OR_DIR=${INPUT_FILE_OR_DIR:-.}
STRICT=""
if [ "$INPUT_STRICT" == "true" ]; then