Skip to content

Commit

Permalink
Merge pull request #1 from ruzickap/enhancement-default_path
Browse files Browse the repository at this point in the history
Use the current directory as default path for yamllint
  • Loading branch information
ibiqlik authored Jan 27, 2020
2 parents 0080381 + cf0212b commit 26e96b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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
```
8 changes: 3 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,4 +20,4 @@ if [ ! -z "$INPUT_CONFIG_DATA" ]; then
CONFIG_DATA="-d $INPUT_CONFIG_DATA"
fi

yamllint $CONFIG_FILE $CONFIG_DATA -f $INPUT_FORMAT $STRICT $INPUT_FILE_OR_DIR
yamllint $CONFIG_FILE $CONFIG_DATA -f $INPUT_FORMAT $STRICT $INPUT_FILE_OR_DIR

0 comments on commit 26e96b3

Please sign in to comment.