A Github action for validating .yaml files using JSON schemas
You can now consume the action by referencing the available version.
uses: thiagodnf/yaml-schema-checker@v0.0.12
with:
jsonSchemaFile: schemas/example.schema.json
yamlFiles: folder/subfolder/**/*.yml
or you can use combine patterns and files as array:
uses: thiagodnf/yaml-schema-checker@v0.0.12
with:
jsonSchemaFile: schemas/example.schema.json
yamlFiles: |
file_1.yml,file_2.yml # two files in the same line
file_3.yml
folder/subfolder/**/*.yml
This project uses glob to read files
Required A JSON schema file following the format used at https://www.schemastore.org
Required A list of files, directories, and wildcard patterns to be validated
Optional Separator used to split the files input. Default is ,
(comma).
Comma separated list of files that passed
Comma separated list of files that failed
If you run this GitHub Actions, this is what the log information looks like:
Run thiagodnf/yaml-schema-checker@v0.0.12
Json Schema: schemas/example.schema.json
Yaml Files: folder/subfolder/**/*.yml
Found 4 file(s). Checking them:
❌ folder/subfolder/events/fake1.yml
- instance.type is not one of enum values: conference,workshop,symposium
✅ folder/subfolder/events/fake2.yml
❌ folder/subfolder/events/fake3.yml
- instance.id is not of a type(s) string
- instance.type is not one of enum values: conference,workshop,symposium
❌ folder/subfolder/events/fake4.yml
- instance.title is not of a type(s) string
Done. All files checked
Error: It was found 3 invalid file(s)
Install the dependencies
npm install
Run the development enviroment
npm run dev
Feel free to access the discussions tab as you need
Contributions to the this project are very welcome! We can't do this alone! Feel free to fork this project, work on it and then make a pull request.
Licensed under the MIT license.
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).
However, if you get some profit from this or just want to encourage me to continue creating stuff, reach out to me if you want to do it.
Thanks!
❤️