1package githubactions
2
3#Action: {
4 @jsonschema(schema="http://json-schema.org/draft-07/schema#")
5 @jsonschema(id="https://json.schemastore.org/github-action.json")
6 matchIf({
7 "runs"?: null | bool | number | string | [...] | {
8 "using"?: "composite"
9 ...
10 }
11 ...
12 }, {
13 "outputs"?: #."outputs-composite"
14 ...
15 }, {
16 "outputs"?: #outputs
17 ...
18 }) & close({
19 // The name of your action. GitHub displays the `name` in the
20 // Actions tab to help visually identify actions in each job.
21 "name"!: string
22
23 // The name of the action's author.
24 "author"?: string
25
26 // A short description of the action.
27 "description"!: string
28
29 // Input parameters allow you to specify data that the action
30 // expects to use during runtime. GitHub stores input parameters
31 // as environment variables. Input ids with uppercase letters are
32 // converted to lowercase during runtime. We recommended using
33 // lowercase input ids.
34 "inputs"?: close({
35 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$"]: close({
36 // A string description of the input parameter.
37 "description"!: string
38
39 // A string shown to users using the deprecated input.
40 "deprecationMessage"?: string
41
42 // A boolean to indicate whether the action requires the input
43 // parameter. Set to `true` when the parameter is required.
44 "required"?: bool
45
46 // A string representing the default value. The default value is
47 // used when an input parameter isn't specified in a workflow
48 // file.
49 "default"?: string
50 })
51 }
52 })
53 "outputs"?: _
54 "runs"!: matchN(1, [#."runs-javascript", #."runs-composite", #."runs-docker"])
55
56 // You can use a color and Feather icon to create a badge to
57 // personalize and distinguish your action. Badges are shown next
58 // to your action name in GitHub Marketplace.
59 "branding"?: close({
60 // The background color of the badge.
61 "color"?: "white" | "black" | "yellow" | "blue" | "green" | "orange" | "red" | "purple" | "gray-dark"
62
63 // The name of the Feather icon to use.
64 "icon"?: "activity" | "airplay" | "alert-circle" | "alert-octagon" | "alert-triangle" | "align-center" | "align-justify" | "align-left" | "align-right" | "anchor" | "aperture" | "archive" | "arrow-down-circle" | "arrow-down-left" | "arrow-down-right" | "arrow-down" | "arrow-left-circle" | "arrow-left" | "arrow-right-circle" | "arrow-right" | "arrow-up-circle" | "arrow-up-left" | "arrow-up-right" | "arrow-up" | "at-sign" | "award" | "bar-chart-2" | "bar-chart" | "battery-charging" | "battery" | "bell-off" | "bell" | "bluetooth" | "bold" | "book-open" | "book" | "bookmark" | "box" | "briefcase" | "calendar" | "camera-off" | "camera" | "cast" | "check-circle" | "check-square" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "chevrons-down" | "chevrons-left" | "chevrons-right" | "chevrons-up" | "circle" | "clipboard" | "clock" | "cloud-drizzle" | "cloud-lightning" | "cloud-off" | "cloud-rain" | "cloud-snow" | "cloud" | "code" | "command" | "compass" | "copy" | "corner-down-left" | "corner-down-right" | "corner-left-down" | "corner-left-up" | "corner-right-down" | "corner-right-up" | "corner-up-left" | "corner-up-right" | "cpu" | "credit-card" | "crop" | "crosshair" | "database" | "delete" | "disc" | "dollar-sign" | "download-cloud" | "download" | "droplet" | "edit-2" | "edit-3" | "edit" | "external-link" | "eye-off" | "eye" | "fast-forward" | "feather" | "file-minus" | "file-plus" | "file-text" | "file" | "film" | "filter" | "flag" | "folder-minus" | "folder-plus" | "folder" | "gift" | "git-branch" | "git-commit" | "git-merge" | "git-pull-request" | "globe" | "grid" | "hard-drive" | "hash" | "headphones" | "heart" | "help-circle" | "home" | "image" | "inbox" | "info" | "italic" | "layers" | "layout" | "life-buoy" | "link-2" | "link" | "list" | "loader" | "lock" | "log-in" | "log-out" | "mail" | "map-pin" | "map" | "maximize-2" | "maximize" | "menu" | "message-circle" | "message-square" | "mic-off" | "mic" | "minimize-2" | "minimize" | "minus-circle" | "minus-square" | "minus" | "monitor" | "moon" | "more-horizontal" | "more-vertical" | "move" | "music" | "navigation-2" | "navigation" | "octagon" | "package" | "paperclip" | "pause-circle" | "pause" | "percent" | "phone-call" | "phone-forwarded" | "phone-incoming" | "phone-missed" | "phone-off" | "phone-outgoing" | "phone" | "pie-chart" | "play-circle" | "play" | "plus-circle" | "plus-square" | "plus" | "pocket" | "power" | "printer" | "radio" | "refresh-ccw" | "refresh-cw" | "repeat" | "rewind" | "rotate-ccw" | "rotate-cw" | "rss" | "save" | "scissors" | "search" | "send" | "server" | "settings" | "share-2" | "share" | "shield-off" | "shield" | "shopping-bag" | "shopping-cart" | "shuffle" | "sidebar" | "skip-back" | "skip-forward" | "slash" | "sliders" | "smartphone" | "speaker" | "square" | "star" | "stop-circle" | "sun" | "sunrise" | "sunset" | "table" | "tablet" | "tag" | "target" | "terminal" | "thermometer" | "thumbs-down" | "thumbs-up" | "toggle-left" | "toggle-right" | "trash-2" | "trash" | "trending-down" | "trending-up" | "triangle" | "truck" | "tv" | "type" | "umbrella" | "underline" | "unlock" | "upload-cloud" | "upload" | "user-check" | "user-minus" | "user-plus" | "user-x" | "user" | "users" | "video-off" | "video" | "voicemail" | "volume-1" | "volume-2" | "volume-x" | "volume" | "watch" | "wifi-off" | "wifi" | "wind" | "x-circle" | "x-square" | "x" | "zap-off" | "zap" | "zoom-in" | "zoom-out"
65 })
66 })
67
68 // Output parameters allow you to declare data that an action
69 // sets. Actions that run later in a workflow can use the output
70 // data set in previously run actions. For example, if you had an
71 // action that performed the addition of two inputs (x + y = z),
72 // the action could output the sum (z) for other actions to use
73 // as an input.
74 // If you don't declare an output in your action metadata file,
75 // you can still set outputs and use them in a workflow.
76 #: "outputs-composite": close({
77 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$"]: close({
78 // A string description of the output parameter.
79 "description"!: string
80
81 // The value that the output parameter will be mapped to. You can
82 // set this to a string or an expression with context. For
83 // example, you can use the steps context to set the value of an
84 // output to the output value of a step.
85 "value"!: string
86 })
87 }
88 })
89
90 // Allows you to define conditions for the `post:` action
91 // execution. The `post:` action will only run if the conditions
92 // in `post-if` are met. If not set, then `post-if` defaults to
93 // `always()`.
94 #: "post-if": string
95
96 // Allows you to define conditions for the `pre:` action
97 // execution. The `pre:` action will only run if the conditions
98 // in `pre-if` are met. If not set, then `pre-if` defaults to
99 // `always()`. Note that the `step` context is unavailable, as no
100 // steps have run yet.
101 #: "pre-if": string
102
103 // Configures the path to the composite action, and the
104 // application used to execute the code.
105 #: "runs-composite": close({
106 // To use a composite run steps action, set this to 'composite'.
107 "using"!: "composite"
108
109 // The run steps that you plan to run in this action.
110 "steps"!: [...matchN(1, [{
111 "run"!: _
112 "shell"!: _
113 ...
114 }, {
115 "uses"!: _
116 ...
117 }]) & close({
118 // The command you want to run. This can be inline or a script in
119 // your action repository.
120 "run"?: string
121
122 // The shell where you want to run the command.
123 "shell"?: matchN(>=1, [string, "bash" | "pwsh" | "python" | "sh" | "cmd" | "powershell"])
124
125 // Selects an action to run as part of a step in your job.
126 "uses"?: string
127
128 // A map of the input parameters defined by the action. Each input
129 // parameter is a key/value pair. Input parameters are set as
130 // environment variables. The variable is prefixed with INPUT_
131 // and converted to upper case.
132 "with"?: {
133 ...
134 }
135
136 // The name of the composite run step.
137 "name"?: string
138
139 // A unique identifier for the step. You can use the `id` to
140 // reference the step in contexts.
141 "id"?: string
142
143 // You can use the if conditional to prevent a step from running
144 // unless a condition is met. You can use any supported context
145 // and expression to create a conditional.
146 // Expressions in an if conditional do not require the ${{ }}
147 // syntax. For more information, see
148 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.
149 "if"?: string
150
151 // Sets a map of environment variables for only that step.
152 "env"?: matchN(1, [{
153 [string]: bool | number | string
154 }, #stringContainingExpressionSyntax])
155
156 // Prevents a job from failing when a step fails. Set to true to
157 // allow a job to pass when this step fails.
158 "continue-on-error"?: matchN(1, [bool, #expressionSyntax])
159
160 // Specifies the working directory where the command is run.
161 "working-directory"?: string
162 })]
163 })
164
165 // Configures the image used for the Docker action.
166 #: "runs-docker": close({
167 // You must set this value to 'docker'.
168 "using"!: "docker"
169
170 // The Docker image to use as the container to run the action. The
171 // value can be the Docker base image name, a local `Dockerfile`
172 // in your repository, or a public image in Docker Hub or another
173 // registry. To reference a `Dockerfile` local to your
174 // repository, use a path relative to your action metadata file.
175 // The `docker` application will execute this file.
176 "image"!: string
177
178 // Specifies a key/value map of environment variables to set in
179 // the container environment.
180 "env"?: matchN(1, [{
181 [string]: bool | number | string
182 }, #stringContainingExpressionSyntax])
183
184 // Overrides the Docker `ENTRYPOINT` in the `Dockerfile`, or sets
185 // it if one wasn't already specified. Use `entrypoint` when the
186 // `Dockerfile` does not specify an `ENTRYPOINT` or you want to
187 // override the `ENTRYPOINT` instruction. If you omit
188 // `entrypoint`, the commands you specify in the Docker
189 // `ENTRYPOINT` instruction will execute. The Docker `ENTRYPOINT
190 // instruction has a *shell* form and *exec* form. The Docker
191 // `ENTRYPOINT` documentation recommends using the *exec* form of
192 // the `ENTRYPOINT` instruction.
193 "entrypoint"?: string
194
195 // Allows you to run a script before the `entrypoint` action
196 // begins. For example, you can use `pre-entrypoint:` to run a
197 // prerequisite setup script. GitHub Actions uses `docker run` to
198 // launch this action, and runs the script inside a new container
199 // that uses the same base image. This means that the runtime
200 // state is different from the main `entrypoint` container, and
201 // any states you require must be accessed in either the
202 // workspace, `HOME`, or as a `STATE_` variable. The
203 // `pre-entrypoint:` action always runs by default but you can
204 // override this using `pre-if`.
205 "pre-entrypoint"?: string
206 "pre-if"?: #."pre-if"
207
208 // Allows you to run a cleanup script once the `runs.entrypoint`
209 // action has completed. GitHub Actions uses `docker run` to
210 // launch this action. Because GitHub Actions runs the script
211 // inside a new container using the same base image, the runtime
212 // state is different from the main `entrypoint` container. You
213 // can access any state you need in either the workspace, `HOME`,
214 // or as a `STATE_` variable. The `post-entrypoint:` action
215 // always runs by default but you can override this using
216 // `post-if`.
217 "post-entrypoint"?: string
218 "post-if"?: #."post-if"
219
220 // An array of strings that define the inputs for a Docker
221 // container. Inputs can include hardcoded strings. GitHub passes
222 // the `args` to the container's `ENTRYPOINT` when the container
223 // starts up.
224 // The `args` are used in place of the `CMD` instruction in a
225 // `Dockerfile`. If you use `CMD` in your `Dockerfile`, use the
226 // guidelines ordered by preference:
227 // - Document required arguments in the action's README and omit
228 // them from the `CMD` instruction.
229 // - Use defaults that allow using the action without specifying
230 // any `args`.
231 // - If the action exposes a `--help` flag, or something similar,
232 // use that to make your action self-documenting.
233 "args"?: [...string]
234 })
235
236 // Configures the path to the action's code and the application
237 // used to execute the code.
238 #: "runs-javascript": close({
239 // The application used to execute the code specified in `main`.
240 "using"!: "node12" | "node16" | "node20" | "node24"
241
242 // The file that contains your action code. The application
243 // specified in `using` executes this file.
244 "main"!: string
245
246 // Allows you to run a script at the start of a job, before the
247 // `main:` action begins. For example, you can use `pre:` to run
248 // a prerequisite setup script. The application specified with
249 // the `using` syntax will execute this file. The `pre:` action
250 // always runs by default but you can override this using
251 // `pre-if`.
252 "pre"?: string
253 "pre-if"?: #."pre-if"
254
255 // Allows you to run a script at the end of a job, once the
256 // `main:` action has completed. For example, you can use `post:`
257 // to terminate certain processes or remove unneeded files. The
258 // application specified with the `using` syntax will execute
259 // this file. The `post:` action always runs by default but you
260 // can override this using `post-if`.
261 "post"?: string
262 "post-if"?: #."post-if"
263 })
264
265 #expressionSyntax: =~"""
266 ^\\$\\{\\{(.|[\r
267 ])*\\}\\}$
268 """
269
270 // Output parameters allow you to declare data that an action
271 // sets. Actions that run later in a workflow can use the output
272 // data set in previously run actions. For example, if you had an
273 // action that performed the addition of two inputs (x + y = z),
274 // the action could output the sum (z) for other actions to use
275 // as an input.
276 // If you don't declare an output in your action metadata file,
277 // you can still set outputs and use them in a workflow.
278 #outputs: close({
279 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$"]: close({
280 // A string description of the output parameter.
281 "description"!: string
282 })
283 }
284 })
285
286 #stringContainingExpressionSyntax: =~"""
287 ^.*\\$\\{\\{(.|[\r
288 ])*\\}\\}.*$
289 """
290}