-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (49 loc) · 1.47 KB
/
validate.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: validate-json
on:
workflow_call:
inputs:
should_download:
description: "Download JSON artifacts if called by another workflow?"
type: boolean
outputs:
is_valid:
description: "Is the JSON valid?"
value: ${{ jobs.validate.outputs.is_valid}}
pull_request:
branches: ["*"]
workflow_dispatch:
jobs:
validate:
runs-on: ubuntu-latest
outputs:
is_valid: ${{ steps.save_state.outputs.is_valid}}
steps:
- uses: actions/checkout@v4
- name: Download JSON artifacts # if called by another workflow
if: ${{ inputs.should_download }}
uses: actions/download-artifact@v4
with:
name: json-files
path: json
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.22.4"
- name: Install Go dependencies
run: go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest
- name: Validate JSON files
id: validate_json
run: python validate-json.py schema.json json
- name: Save state
id: save_state
if: steps.validate_json.conclusion == 'success'
run: echo "is_valid=true" >> $GITHUB_OUTPUT