Skip to content

Commit

Permalink
docs: add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
stigok committed Mar 2, 2020
1 parent fe67ccc commit b2167fe
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# yaml-schema-validator-github-action

A GitHub action that uses [Yamale][] for YAML schema validation.

## Usage

Configure a new workflow in your project referencing this repository.
The following example sets up a check to validate the file *target.yaml*
using the Yamale schema defined in *schemas/schema.yaml* within the target
repository.

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

```
name: YAML schema validator
on: [push]
jobs:
yaml-schema-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: nrkno/[email protected]
with:
schema: 'schemas/schema.yaml'
target: 'target.yaml'
# Uncomment to enable strict checks
# strict: '1'
```

## 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
```


[Yamale]: https://github.com/23andMe/Yamale

0 comments on commit b2167fe

Please sign in to comment.