(Feat) add YAML and JSON linter on github actions #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint YAML and JSON | |
on: | |
push: | |
paths: | |
- '**/*.yml' | |
- '**/*.yaml' | |
- '**/*.json' | |
pull_request: | |
paths: | |
- '**/*.yml' | |
- '**/*.yaml' | |
- '**/*.json' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install linters | |
run: | | |
pip install yamllint | |
pip install jsonlint | |
- name: Lint YAML files | |
run: | | |
yamllint . | |
- name: Lint JSON files | |
run: | | |
find . -name '*.json' -exec jsonlint -q {} \; | |
- name: Display linter versions (Optional) | |
run: | | |
yamllint --version | |
jsonlint --version | |