Skip to content

Commit 4a4341b

Browse files
Add json schema for actions definitions (#149)
* Add json schema for actions definitions * Apply suggestions from code review Co-Authored-By: Ryan Blunden <[email protected]> * Remove Dockerfile field Co-authored-by: Ryan Blunden <[email protected]>
1 parent b3a1ef4 commit 4a4341b

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

actions.schema.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "actions.schema.json#",
4+
"title": "Action Definition",
5+
"description": "Describes an action with its scope and steps to perform.",
6+
"allowComments": true,
7+
"type": "object",
8+
"additionalProperties": false,
9+
"required": [
10+
"scopeQuery",
11+
"steps"
12+
],
13+
"properties": {
14+
"scopeQuery": {
15+
"description": "A Sourcegraph search query to generate a list of repositories over which to run the action. Use 'src actions scope-query' to see which repositories are matched by the query.",
16+
"type": "string",
17+
"minLength": 1
18+
},
19+
"steps": {
20+
"description": "A list of action steps to execute in each repository.",
21+
"type": "array",
22+
"items": {
23+
"type": "object",
24+
"required": ["type"],
25+
"additionalProperties": false,
26+
"properties": {
27+
"type": {
28+
"description": "Can be either \"command\", which executes the step in the native environment (OS) of the machine where 'src actions exec' is executed, or \"docker\" which runs a container with the repository contents mounted in at `/work`. Note that local images (not from a Docker registry) must be built manually prior to executing.",
29+
"type": "string",
30+
"enum": ["command", "docker"]
31+
},
32+
"args": {
33+
"description": "The command to execute.",
34+
"type": "array",
35+
"minItems": 1,
36+
"items": {
37+
"type": "string"
38+
}
39+
},
40+
"image": {
41+
"description": "The Docker image handle for running the container executing this step. Just like when running `docker run`, `args` here override the default `CMD` to be executed.",
42+
"type": "string",
43+
"minLength": 1
44+
}
45+
},
46+
"oneOf": [
47+
{
48+
"required": ["args"],
49+
"properties": {
50+
"type": { "const": "command" },
51+
"image": { "type": "null" }
52+
}
53+
},
54+
{
55+
"required": ["image"],
56+
"properties": {
57+
"type": { "const": "docker" }
58+
}
59+
}
60+
]
61+
}
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)