-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Feat) add YAML and JSON linter on github actions
- Loading branch information
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 | ||
Check failure on line 20 in .github/workflows/linter.yml GitHub Actions / lint
|
||
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 | ||
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