Skip to content

Commit b2167fe

Browse files
committed
docs: add readme
1 parent fe67ccc commit b2167fe

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# yaml-schema-validator-github-action
2+
3+
A GitHub action that uses [Yamale][] for YAML schema validation.
4+
5+
## Usage
6+
7+
Configure a new workflow in your project referencing this repository.
8+
The following example sets up a check to validate the file *target.yaml*
9+
using the Yamale schema defined in *schemas/schema.yaml* within the target
10+
repository.
11+
12+
- Filenames are relative to the repository root.
13+
- Enable strict checking by setting `strict` to a non-empty string.
14+
- For help with the schema definitions, see [Yamale][].
15+
16+
```
17+
name: YAML schema validator
18+
on: [push]
19+
20+
jobs:
21+
yaml-schema-validation:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
- uses: nrkno/yaml-schema-validator-github-action@v0.0.1-pre
26+
with:
27+
schema: 'schemas/schema.yaml'
28+
target: 'target.yaml'
29+
# Uncomment to enable strict checks
30+
# strict: '1'
31+
```
32+
33+
## Developing
34+
35+
Create and enable a Python virtualenv (not strictly required, but makes testing
36+
more robust)
37+
38+
```
39+
$ python -m venv venv
40+
$ source venv/bin/activate
41+
```
42+
43+
Install dependencies
44+
45+
```
46+
$ pip install -r requirements.txt
47+
```
48+
49+
Do a test-run with the provided examples
50+
51+
```
52+
$ ./entrypoint.sh example/schema.yaml example/file.yaml
53+
```
54+
55+
### Using Docker
56+
57+
Build the container and reference files within the example/ folder.
58+
59+
```
60+
$ docker build -t yaml-schema-validator .
61+
$ docker run yaml-schema-validator example/schema.yaml example/file.yaml
62+
```
63+
64+
65+
[Yamale]: https://github.com/23andMe/Yamale

0 commit comments

Comments
 (0)