Skip to content

NCATS-Tangerine/yaml-schema-validator-github-action

 
 

Repository files navigation

yaml-schema-validator-github-action

A GitHub action that uses Yamale for YAML schema validation.

Usage

  • Filenames are relative to the repository root.
  • Enable strict checking by setting strict to a non-empty string.
  • For help with the schema definitions and reference, see Yamale.

The following example sets up a check to validate a YAML file in your repository, target.yaml, using a schema defined in schemas/schema.yaml:

name: YAML schema validator
on: [push]

jobs:
  yaml-schema-validation:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: nrkno/yaml-schema-validator-github-action@master
      with:
        schema: 'schemas/schema.yaml'
        target: 'target.yaml'
        # Uncomment to enable strict checks
        # strict: '1'

Versioning

To bind the action to a specific release, prefix with @<tag>. E.g. nrkno/[email protected].

https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsuses

Developing

Create and enable a Python virtualenv (not strictly required, but makes testing more robust)

$ python -m venv venv
$ source venv/bin/activate

Install dependencies

$ pip install -r requirements.txt

Do a test-run with the provided examples

$ ./entrypoint.sh example/schema.yaml example/file.yaml

Using Docker

Build the container and reference files within the example/ folder.

$ docker build -t yaml-schema-validator .
$ docker run yaml-schema-validator example/schema.yaml example/file.yaml
$ docker run yaml-schema-validator example/schema.yaml example/file-invalid.yaml

About

A GitHub action that uses Yamale for YAML schema validation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 58.5%
  • Dockerfile 41.5%