https://github.com/dungpham91/lint-json-inside-yaml
Github Actions detect and validate JSON data inside YAML files.
https://github.com/dungpham91/lint-json-inside-yaml
github-actions json jsonlint lint yaml
Last synced: about 2 months ago
JSON representation
Github Actions detect and validate JSON data inside YAML files.
- Host: GitHub
- URL: https://github.com/dungpham91/lint-json-inside-yaml
- Owner: dungpham91
- License: mit
- Created: 2023-09-21T09:59:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-30T05:45:24.000Z (7 months ago)
- Last Synced: 2024-10-30T08:38:53.965Z (7 months ago)
- Topics: github-actions, json, jsonlint, lint, yaml
- Language: Python
- Homepage:
- Size: 546 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Github Actions lint-json-inside-yaml
This action detects and validates JSON data inside YAML files.
## Usages
Simple as:
```yaml
uses: dungpham91/[email protected]
```### Optional input parameters
- `folder_or_file` - enter file/folder (space separated), wildcards accepted. Examples:
- `.` - checks for JSON in all files of the current folder, including recursive subfolders
- `file1.yaml` - check JSON for a single file
- `file1.yaml file2.yaml` - check JSON for 2 or more files
- `folder1 folder2` - check JSON for 2 or more folders
- `folder1 file1.yaml` - check JSON for both file and folder at the same time
- `folder1/*.yaml folder2/*values.yaml` - check JSON for files in folder using wildcards### Example usage in workflow
```yaml
---
name: JSON Linton: [push]
jobs:
json-lint:
runs-on: ubuntu-latest
steps:- uses: actions/checkout@v4
with:
fetch-depth: 0- name: JSON lint
uses: dungpham91/[email protected]
with:
folder_or_file: ./test-data
```Use in conjunction with the action to detect file changes
```yaml
name: JSON Linton:
push:
branches:
- mainjobs:
json-lint:
runs-on: ubuntu-latest
steps:- uses: actions/checkout@v4
with:
fetch-depth: 0- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
with:
files: |
test-data/**- name: JSON lint
uses: dungpham91/[email protected]
with:
folder_or_file: ${{ steps.changed-files.outputs.all_changed_files }}
```