-
Notifications
You must be signed in to change notification settings - Fork 5
50 lines (44 loc) · 2.34 KB
/
validate-json-files.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
name: JSON file validation
on:
workflow_dispatch:
pull_request:
branches:
- 'main'
jobs:
validate-json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set branch variable
id: branch_var
run: echo "branch_name=$(echo $GITHUB_REF | sed 's/refs\/heads\///')" >> $GITHUB_ENV
- name: Validate successfully reproduced breaking update JSON
uses: cardinalby/schema-validator-action@v3
with:
schema: "schemas/successful-reproduction-schemas/breaking-update.schema.json"
file: "data/benchmark/*.json"
refSchemasMap:
'{"https://github.com/chains-project/breaking-updates/blob/main/schemas/successful-reproduction-schemas/breaking-update-dependency.schema.json": "schemas/successful-reproduction-schemas/breaking-update-dependency.schema.json"}'
- name: Validate reproduction failed breaking update JSON
uses: cardinalby/schema-validator-action@v3
with:
schema: "schemas/unsuccessful-reproduction-schemas/breaking-update.schema.json"
file: "data/unsuccessful-reproductions/*.json"
refSchemasMap:
'{"https://github.com/chains-project/breaking-updates/blob/main/schemas/unsuccessful-reproduction-schemas/breaking-update-dependency.schema.json": "schemas/unsuccessful-reproduction-schemas/breaking-update-dependency.schema.json"}'
- name: Check if JSON files exist
id: file_check
run: |
if find data/in-progress-reproductions -name "*.json" -print -quit | grep -q .; then
echo "check_result=true" >> $GITHUB_OUTPUT
else
echo "check_result=false" >> $GITHUB_OUTPUT
fi
- name: Validate not reproduced breaking update JSON
if: steps.file_check.outputs.check_result == 'true'
uses: cardinalby/schema-validator-action@v3
with:
schema: "schemas/not-attempted-reproduction-schemas/breaking-update.schema.json"
file: "data/in-progress-reproductions/*.json"
refSchemasMap:
'{"https://raw.githubusercontent.com/${{ github.repository }}/${{ env.branch_name }}/schemas/not-attempted-reproduction-schemas/breaking-update-dependency.schema.json": "schemas/not-attempted-reproduction-schemas/breaking-update-dependency.schema.json"}'