Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ibiqlik/action-yamllint
GitHub Action - Yaml Lint
https://github.com/ibiqlik/action-yamllint
Last synced: about 1 month ago
JSON representation
GitHub Action - Yaml Lint
- Host: GitHub
- URL: https://github.com/ibiqlik/action-yamllint
- Owner: ibiqlik
- License: mit
- Created: 2019-10-16T08:26:47.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-24T08:22:10.000Z (over 1 year ago)
- Last Synced: 2024-10-29T14:31:06.206Z (about 1 month ago)
- Language: Shell
- Size: 32.2 KB
- Stars: 95
- Watchers: 3
- Forks: 41
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ccamel - ibiqlik/action-yamllint - GitHub Action - Yaml Lint (Shell)
README
# GitHub YAMLlint
This action executes `yamllint` (https://github.com/adrienverge/yamllint) against files or folder
## Usage
Simple as:
```yaml
- uses: ibiqlik/action-yamllint@v3
```### Optional input 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,github,auto] (default: parsable)`
- `strict` - Return non-zero exit code on warnings as well as errors `[true,false] (default: false)`
- `no_warnings` - Output only error level problems `[true,false] (default: false)`**Note:** If `.yamllint` configuration file exists in your root folder, yamllint automatically uses it.
### Outputs
`logfile` - Path to yamllint log file
`${{ steps..outputs.logfile }}`
**Note:** Each yamllint run (for example if you define multiple yamllint steps) has its own log
### Example usage in workflow
```yaml
---
name: Yaml Lint
on: [push] # yamllint disable-line rule:truthy
jobs:
lintAllTheThings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: myfolder/*values*.yaml
config_file: .yamllint.yml
```Or just simply lint all yaml files in the repository:
```yaml
---
name: Yaml Lint
on: [push] # yamllint disable-line rule:truthy
jobs:
lintAllTheThings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
```Config data examples:
```yaml
# Single line
config_data: "{extends: default, rules: {new-line-at-end-of-file: disable}}"
`````` yaml
# Multi line
config_data: |
extends: default
rules:
new-line-at-end-of-file:
level: warning
trailing-spaces:
level: warning
```Use output to save/upload the log in artifact. Note, you must have `id` in the step running the yamllint action.
```yaml
---
name: Yaml Lint
on: [push] # yamllint disable-line rule:truthy
jobs:
lintAllTheThings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: yaml-lint
uses: ibiqlik/action-yamllint@v3- run: echo ${{ steps.yaml-lint.outputs.logfile }}
- uses: actions/upload-artifact@v2
if: always()
with:
name: yamllint-logfile
path: ${{ steps.yaml-lint.outputs.logfile }}
```