-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.1 KB
/
validate-updates.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Validate updates
on:
push:
paths:
- 'updates.yaml'
- 'updates.schema.json'
pull_request:
paths:
- 'updates.yaml'
- 'updates.schema.json'
jobs:
validate-yaml:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y yq
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install Ajv CLI and js-yaml
run: |
npm install -g ajv-cli
npm install -g js-yaml
- name: Validate updates.yaml
id: validate-updates
run: |
js-yaml updates.yaml > converted-file.json
ajv validate -s updates.schema.json -d converted-file.json
- name: Print success message
if: success()
run: echo "YAML file validated successfully against the schema."
- name: Print failure message
if: failure()
run: echo "YAML validation failed. Check the schema and the YAML file."