Skip to content

Commit e5b8587

Browse files
committed
wip: add schema for validating cookbook
1 parent 126bff6 commit e5b8587

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: config-validator
2+
3+
on:
4+
workflow_call:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}=${{ github.head_ref}}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
config-validator:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
env:
16+
THIS_ACTION_REF: "${{github.action_ref}}"
17+
steps:
18+
- uses: actions/checkout@v6
19+
- name: Validate workflows
20+
uses: dsanders11/json-schema-validate-action@v2.0.0
21+
with:
22+
# Schema is not versioned by URL — the versioning is defined _in_ the schema
23+
# The latest version of the schema should always be used for validation.
24+
schema: https://raw.githubusercontent.com/ProjectPythia/cookbook-actions/refs/heads/feat/clinder/cookbook.schema.json
25+
files: cookbook.yaml

cookbook.schema.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://github.com/projectpythia/pythia-config/cookbook.schema.json",
4+
"$ref": "#/definitions/config",
5+
"definitions": {
6+
"config": {
7+
"$comment": "Allow multiple versions of config to co-exist across a set of repositories by requiring the schema version",
8+
"oneOf": [{ "$ref": "#/definitions/configV1" }]
9+
},
10+
"configV1": {
11+
"type": "object",
12+
"additionalProperties": false,
13+
"required": ["version"],
14+
"properties": {
15+
"version": {
16+
"const": 1
17+
},
18+
"gallery": {
19+
"$ref": "#/definitions/gallery"
20+
},
21+
"ci": {
22+
"$ref": "#/definitions/ci"
23+
}
24+
}
25+
},
26+
"ci": {
27+
"properties": {
28+
"cache-execution": {
29+
"type": "boolean",
30+
"default": true
31+
},
32+
"execute-on-binder": {
33+
"type": "boolean",
34+
"default": false
35+
}
36+
},
37+
"required": [],
38+
"type": "object",
39+
"additionalProperties": false
40+
},
41+
"gallery": {
42+
"properties": {
43+
"thumbnail": {
44+
"type": "string"
45+
},
46+
"tags": {
47+
"$ref": "#/definitions/tags"
48+
}
49+
},
50+
"required": [],
51+
"type": "object",
52+
"additionalProperties": false
53+
},
54+
"tags": {
55+
"type": "object",
56+
"properties": {},
57+
"additionalProperties": {
58+
"type": "array",
59+
"items": {
60+
"type": "string"
61+
}
62+
}
63+
}
64+
}
65+
}

0 commit comments

Comments
 (0)