1package githubactions
2
3import (
4 "struct"
5 "strings"
6)
7
8#Workflow: {
9 @jsonschema(schema="http://json-schema.org/draft-07/schema#")
10 @jsonschema(id="https://json.schemastore.org/github-workflow.json")
11 close({
12 // The name of your workflow. GitHub displays the names of your
13 // workflows on your repository's actions page. If you omit this
14 // field, GitHub sets the name to the workflow's filename.
15 "name"?: string
16
17 // The name of the GitHub event that triggers the workflow. You
18 // can provide a single event string, array of events, array of
19 // event types, or an event configuration map that schedules a
20 // workflow or restricts the execution of a workflow to specific
21 // files, tags, or branch changes. For a list of available
22 // events, see
23 // https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows.
24 "on"!: matchN(1, [#event, [...#event] & [_, ...], close({
25 // Runs your workflow anytime the branch_protection_rule event
26 // occurs. More than one activity type triggers this event.
27 "branch_protection_rule"?: #eventObject & (null | bool | number | string | [...] | {
28 "types"?: #types & (null | bool | number | string | [..."created" | "edited" | "deleted"] | {
29 ...
30 })
31 ...
32 })
33
34 // Runs your workflow anytime the check_run event occurs. More
35 // than one activity type triggers this event. For information
36 // about the REST API, see
37 // https://developer.github.com/v3/checks/runs.
38 "check_run"?: #eventObject & (null | bool | number | string | [...] | {
39 "types"?: #types & (null | bool | number | string | [..."created" | "rerequested" | "completed" | "requested_action"] | {
40 ...
41 })
42 ...
43 })
44
45 // Runs your workflow anytime the check_suite event occurs. More
46 // than one activity type triggers this event. For information
47 // about the REST API, see
48 // https://developer.github.com/v3/checks/suites/.
49 "check_suite"?: #eventObject & (null | bool | number | string | [...] | {
50 "types"?: #types & (null | bool | number | string | [..."completed" | "requested" | "rerequested"] | {
51 ...
52 })
53 ...
54 })
55
56 // Runs your workflow anytime someone creates a branch or tag,
57 // which triggers the create event. For information about the
58 // REST API, see
59 // https://developer.github.com/v3/git/refs/#create-a-reference.
60 "create"?: #eventObject
61
62 // Runs your workflow anytime someone deletes a branch or tag,
63 // which triggers the delete event. For information about the
64 // REST API, see
65 // https://developer.github.com/v3/git/refs/#delete-a-reference.
66 "delete"?: #eventObject
67
68 // Runs your workflow anytime someone creates a deployment, which
69 // triggers the deployment event. Deployments created with a
70 // commit SHA may not have a Git ref. For information about the
71 // REST API, see
72 // https://developer.github.com/v3/repos/deployments/.
73 "deployment"?: #eventObject
74
75 // Runs your workflow anytime a third party provides a deployment
76 // status, which triggers the deployment_status event.
77 // Deployments created with a commit SHA may not have a Git ref.
78 // For information about the REST API, see
79 // https://developer.github.com/v3/repos/deployments/#create-a-deployment-status.
80 "deployment_status"?: #eventObject
81
82 // Runs your workflow anytime the discussion event occurs. More
83 // than one activity type triggers this event. For information
84 // about the GraphQL API, see
85 // https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions
86 "discussion"?: #eventObject & (null | bool | number | string | [...] | {
87 "types"?: #types & (null | bool | number | string | [..."created" | "edited" | "deleted" | "transferred" | "pinned" | "unpinned" | "labeled" | "unlabeled" | "locked" | "unlocked" | "category_changed" | "answered" | "unanswered"] | {
88 ...
89 })
90 ...
91 })
92
93 // Runs your workflow anytime the discussion_comment event occurs.
94 // More than one activity type triggers this event. For
95 // information about the GraphQL API, see
96 // https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions
97 "discussion_comment"?: #eventObject & (null | bool | number | string | [...] | {
98 "types"?: #types & (null | bool | number | string | [..."created" | "edited" | "deleted"] | {
99 ...
100 })
101 ...
102 })
103
104 // Runs your workflow anytime when someone forks a repository,
105 // which triggers the fork event. For information about the REST
106 // API, see
107 // https://developer.github.com/v3/repos/forks/#create-a-fork.
108 "fork"?: #eventObject
109
110 // Runs your workflow when someone creates or updates a Wiki page,
111 // which triggers the gollum event.
112 "gollum"?: #eventObject
113
114 // Runs your workflow anytime the issue_comment event occurs. More
115 // than one activity type triggers this event. For information
116 // about the REST API, see
117 // https://developer.github.com/v3/issues/comments/.
118 "issue_comment"?: #eventObject & (null | bool | number | string | [...] | {
119 "types"?: #types & (null | bool | number | string | [..."created" | "edited" | "deleted"] | {
120 ...
121 })
122 ...
123 })
124
125 // Runs your workflow anytime the issues event occurs. More than
126 // one activity type triggers this event. For information about
127 // the REST API, see https://developer.github.com/v3/issues.
128 "issues"?: #eventObject & (null | bool | number | string | [...] | {
129 "types"?: #types & (null | bool | number | string | [..."opened" | "edited" | "deleted" | "transferred" | "pinned" | "unpinned" | "closed" | "reopened" | "assigned" | "unassigned" | "labeled" | "unlabeled" | "locked" | "unlocked" | "milestoned" | "demilestoned"] | {
130 ...
131 })
132 ...
133 })
134
135 // Runs your workflow anytime the label event occurs. More than
136 // one activity type triggers this event. For information about
137 // the REST API, see
138 // https://developer.github.com/v3/issues/labels/.
139 "label"?: #eventObject & (null | bool | number | string | [...] | {
140 "types"?: #types & (null | bool | number | string | [..."created" | "edited" | "deleted"] | {
141 ...
142 })
143 ...
144 })
145
146 // Runs your workflow when a pull request is added to a merge
147 // queue, which adds the pull request to a merge group. For
148 // information about the merge queue, see
149 // https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request-with-a-merge-queue
150 // .
151 "merge_group"?: #eventObject & (null | bool | number | string | [...] | {
152 "types"?: #types & (null | bool | number | string | [..."checks_requested"] | {
153 ...
154 })
155 ...
156 })
157
158 // Runs your workflow anytime the milestone event occurs. More
159 // than one activity type triggers this event. For information
160 // about the REST API, see
161 // https://developer.github.com/v3/issues/milestones/.
162 "milestone"?: #eventObject & (null | bool | number | string | [...] | {
163 "types"?: #types & (null | bool | number | string | [..."created" | "closed" | "opened" | "edited" | "deleted"] | {
164 ...
165 })
166 ...
167 })
168
169 // Runs your workflow anytime someone pushes to a GitHub
170 // Pages-enabled branch, which triggers the page_build event. For
171 // information about the REST API, see
172 // https://developer.github.com/v3/repos/pages/.
173 "page_build"?: #eventObject
174
175 // Runs your workflow anytime the project event occurs. More than
176 // one activity type triggers this event. For information about
177 // the REST API, see https://developer.github.com/v3/projects/.
178 "project"?: #eventObject & (null | bool | number | string | [...] | {
179 "types"?: #types & (null | bool | number | string | [..."created" | "updated" | "closed" | "reopened" | "edited" | "deleted"] | {
180 ...
181 })
182 ...
183 })
184
185 // Runs your workflow anytime the project_card event occurs. More
186 // than one activity type triggers this event. For information
187 // about the REST API, see
188 // https://developer.github.com/v3/projects/cards.
189 "project_card"?: #eventObject & (null | bool | number | string | [...] | {
190 "types"?: #types & (null | bool | number | string | [..."created" | "moved" | "converted" | "edited" | "deleted"] | {
191 ...
192 })
193 ...
194 })
195
196 // Runs your workflow anytime the project_column event occurs.
197 // More than one activity type triggers this event. For
198 // information about the REST API, see
199 // https://developer.github.com/v3/projects/columns.
200 "project_column"?: #eventObject & (null | bool | number | string | [...] | {
201 "types"?: #types & (null | bool | number | string | [..."created" | "updated" | "moved" | "deleted"] | {
202 ...
203 })
204 ...
205 })
206
207 // Runs your workflow anytime someone makes a private repository
208 // public, which triggers the public event. For information about
209 // the REST API, see https://developer.github.com/v3/repos/#edit.
210 "public"?: #eventObject
211
212 // Runs your workflow anytime the pull_request event occurs. More
213 // than one activity type triggers this event. For information
214 // about the REST API, see https://developer.github.com/v3/pulls.
215 // Note: Workflows do not run on private base repositories when
216 // you open a pull request from a forked repository.
217 // When you create a pull request from a forked repository to the
218 // base repository, GitHub sends the pull_request event to the
219 // base repository and no pull request events occur on the forked
220 // repository.
221 // Workflows don't run on forked repositories by default. You must
222 // enable GitHub Actions in the Actions tab of the forked
223 // repository.
224 // The permissions for the GITHUB_TOKEN in forked repositories is
225 // read-only. For more information about the GITHUB_TOKEN, see
226 // https://help.github.com/en/articles/virtual-environments-for-github-actions.
227 "pull_request"?: matchN(1, [null, matchN(4, [close({
228 "types"?: #types & (null | bool | number | string | [..."assigned" | "unassigned" | "labeled" | "unlabeled" | "opened" | "edited" | "closed" | "reopened" | "synchronize" | "converted_to_draft" | "ready_for_review" | "locked" | "unlocked" | "milestoned" | "demilestoned" | "review_requested" | "review_request_removed" | "auto_merge_enabled" | "auto_merge_disabled" | "enqueued" | "dequeued"] | {
229 ...
230 })
231 "branches"?: #branch
232 "branches-ignore"?: #branch
233 "tags"?: #branch
234 "tags-ignore"?: #branch
235 "paths"?: #path
236 "paths-ignore"?: #path
237 }), matchN(0, [null | bool | number | string | [...] | {
238 "branches"!: _
239 "branches-ignore"!: _
240 ...
241 }]) & {
242 ...
243 }, matchN(0, [null | bool | number | string | [...] | {
244 "tags"!: _
245 "tags-ignore"!: _
246 ...
247 }]) & {
248 ...
249 }, matchN(0, [null | bool | number | string | [...] | {
250 "paths"!: _
251 "paths-ignore"!: _
252 ...
253 }]) & {
254 ...
255 }])])
256
257 // Runs your workflow anytime the pull_request_review event
258 // occurs. More than one activity type triggers this event. For
259 // information about the REST API, see
260 // https://developer.github.com/v3/pulls/reviews.
261 // Note: Workflows do not run on private base repositories when
262 // you open a pull request from a forked repository.
263 // When you create a pull request from a forked repository to the
264 // base repository, GitHub sends the pull_request event to the
265 // base repository and no pull request events occur on the forked
266 // repository.
267 // Workflows don't run on forked repositories by default. You must
268 // enable GitHub Actions in the Actions tab of the forked
269 // repository.
270 // The permissions for the GITHUB_TOKEN in forked repositories is
271 // read-only. For more information about the GITHUB_TOKEN, see
272 // https://help.github.com/en/articles/virtual-environments-for-github-actions.
273 "pull_request_review"?: #eventObject & (null | bool | number | string | [...] | {
274 "types"?: #types & (null | bool | number | string | [..."submitted" | "edited" | "dismissed"] | {
275 ...
276 })
277 ...
278 })
279
280 // Runs your workflow anytime a comment on a pull request's
281 // unified diff is modified, which triggers the
282 // pull_request_review_comment event. More than one activity type
283 // triggers this event. For information about the REST API, see
284 // https://developer.github.com/v3/pulls/comments.
285 // Note: Workflows do not run on private base repositories when
286 // you open a pull request from a forked repository.
287 // When you create a pull request from a forked repository to the
288 // base repository, GitHub sends the pull_request event to the
289 // base repository and no pull request events occur on the forked
290 // repository.
291 // Workflows don't run on forked repositories by default. You must
292 // enable GitHub Actions in the Actions tab of the forked
293 // repository.
294 // The permissions for the GITHUB_TOKEN in forked repositories is
295 // read-only. For more information about the GITHUB_TOKEN, see
296 // https://help.github.com/en/articles/virtual-environments-for-github-actions.
297 "pull_request_review_comment"?: #eventObject & (null | bool | number | string | [...] | {
298 "types"?: #types & (null | bool | number | string | [..."created" | "edited" | "deleted"] | {
299 ...
300 })
301 ...
302 })
303
304 // This event is similar to pull_request, except that it runs in
305 // the context of the base repository of the pull request, rather
306 // than in the merge commit. This means that you can more safely
307 // make your secrets available to the workflows triggered by the
308 // pull request, because only workflows defined in the commit on
309 // the base repository are run. For example, this event allows
310 // you to create workflows that label and comment on pull
311 // requests, based on the contents of the event payload.
312 "pull_request_target"?: matchN(1, [null, matchN(4, [close({
313 "types"?: #types & (null | bool | number | string | [..."assigned" | "unassigned" | "labeled" | "unlabeled" | "opened" | "edited" | "closed" | "reopened" | "synchronize" | "converted_to_draft" | "ready_for_review" | "locked" | "unlocked" | "review_requested" | "review_request_removed" | "auto_merge_enabled" | "auto_merge_disabled"] | {
314 ...
315 })
316 "branches"?: #branch
317 "branches-ignore"?: #branch
318 "tags"?: #branch
319 "tags-ignore"?: #branch
320 "paths"?: #path
321 "paths-ignore"?: #path
322 }), matchN(0, [null | bool | number | string | [...] | {
323 "branches"!: _
324 "branches-ignore"!: _
325 ...
326 }]) & {
327 ...
328 }, matchN(0, [null | bool | number | string | [...] | {
329 "tags"!: _
330 "tags-ignore"!: _
331 ...
332 }]) & {
333 ...
334 }, matchN(0, [null | bool | number | string | [...] | {
335 "paths"!: _
336 "paths-ignore"!: _
337 ...
338 }]) & {
339 ...
340 }])])
341
342 // Runs your workflow when someone pushes to a repository branch,
343 // which triggers the push event.
344 // Note: The webhook payload available to GitHub Actions does not
345 // include the added, removed, and modified attributes in the
346 // commit object. You can retrieve the full commit object using
347 // the REST API. For more information, see
348 // https://developer.github.com/v3/repos/commits/#get-a-single-commit.
349 "push"?: matchN(1, [null, matchN(4, [close({
350 "branches"?: #branch
351 "branches-ignore"?: #branch
352 "tags"?: #branch
353 "tags-ignore"?: #branch
354 "paths"?: #path
355 "paths-ignore"?: #path
356 }), matchN(0, [null | bool | number | string | [...] | {
357 "branches"!: _
358 "branches-ignore"!: _
359 ...
360 }]) & {
361 ...
362 }, matchN(0, [null | bool | number | string | [...] | {
363 "tags"!: _
364 "tags-ignore"!: _
365 ...
366 }]) & {
367 ...
368 }, matchN(0, [null | bool | number | string | [...] | {
369 "paths"!: _
370 "paths-ignore"!: _
371 ...
372 }]) & {
373 ...
374 }])])
375
376 // Runs your workflow anytime a package is published or updated.
377 // For more information, see
378 // https://help.github.com/en/github/managing-packages-with-github-packages.
379 "registry_package"?: #eventObject & (null | bool | number | string | [...] | {
380 "types"?: #types & (null | bool | number | string | [..."published" | "updated"] | {
381 ...
382 })
383 ...
384 })
385
386 // Runs your workflow anytime the release event occurs. More than
387 // one activity type triggers this event. For information about
388 // the REST API, see
389 // https://developer.github.com/v3/repos/releases/ in the GitHub
390 // Developer documentation.
391 "release"?: #eventObject & (null | bool | number | string | [...] | {
392 "types"?: #types & (null | bool | number | string | [..."published" | "unpublished" | "created" | "edited" | "deleted" | "prereleased" | "released"] | {
393 ...
394 })
395 ...
396 })
397
398 // Runs your workflow anytime the status of a Git commit changes,
399 // which triggers the status event. For information about the
400 // REST API, see https://developer.github.com/v3/repos/statuses/.
401 "status"?: #eventObject
402
403 // Runs your workflow anytime the watch event occurs. More than
404 // one activity type triggers this event. For information about
405 // the REST API, see
406 // https://developer.github.com/v3/activity/starring/.
407 "watch"?: #eventObject
408
409 // Allows workflows to be reused by other workflows.
410 "workflow_call"?: null | bool | number | string | [...] | {
411 // When using the workflow_call keyword, you can optionally
412 // specify inputs that are passed to the called workflow from the
413 // caller workflow.
414 "inputs"?: close({
415 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$"]: close({
416 // A string description of the input parameter.
417 "description"?: string
418
419 // A boolean to indicate whether the action requires the input
420 // parameter. Set to true when the parameter is required.
421 "required"?: bool
422
423 // Required if input is defined for the on.workflow_call keyword.
424 // The value of this parameter is a string specifying the data
425 // type of the input. This must be one of: boolean, number, or
426 // string.
427 "type"!: "boolean" | "number" | "string"
428
429 // The default value is used when an input parameter isn't
430 // specified in a workflow file.
431 "default"?: bool | number | string
432 })
433 }
434 })
435
436 // When using the workflow_call keyword, you can optionally
437 // specify inputs that are passed to the called workflow from the
438 // caller workflow.
439 "outputs"?: close({
440 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$"]: close({
441 // A string description of the output parameter.
442 "description"?: string
443
444 // The value that the output parameter will be mapped to. You can
445 // set this to a string or an expression with context. For
446 // example, you can use the steps context to set the value of an
447 // output to the output value of a step.
448 "value"!: string
449 })
450 }
451 })
452
453 // A map of the secrets that can be used in the called workflow.
454 // Within the called workflow, you can use the secrets context to
455 // refer to a secret.
456 "secrets"?: null | bool | number | string | [...] | close({
457 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$"]: null | bool | number | string | [...] | close({
458 // A string description of the secret parameter.
459 "description"?: string
460
461 // A boolean specifying whether the secret must be supplied.
462 "required"?: bool
463 })
464 }
465 })
466 ...
467 }
468
469 // You can now create workflows that are manually triggered with
470 // the new workflow_dispatch event. You will then see a 'Run
471 // workflow' button on the Actions tab, enabling you to easily
472 // trigger a run.
473 "workflow_dispatch"?: null | bool | number | string | [...] | close({
474 // Input parameters allow you to specify data that the action
475 // expects to use during runtime. GitHub stores input parameters
476 // as environment variables. Input ids with uppercase letters are
477 // converted to lowercase during runtime. We recommended using
478 // lowercase input ids.
479 "inputs"?: close({
480 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$"]: #workflowDispatchInput}
481 })
482 })
483
484 // This event occurs when a workflow run is requested or
485 // completed, and allows you to execute a workflow based on the
486 // finished result of another workflow. For example, if your
487 // pull_request workflow generates build artifacts, you can
488 // create a new workflow that uses workflow_run to analyze the
489 // results and add a comment to the original pull request.
490 "workflow_run"?: #eventObject & (null | bool | number | string | [...] | {
491 "types"?: #types & (null | bool | number | string | [..."requested" | "completed" | "in_progress"] | {
492 ...
493 })
494 "workflows"?: [...string] & [_, ...]
495
496 {[=~"^branches(-ignore)?$" & !~"^(types|workflows)$"]: _}
497 ...
498 })
499
500 // You can use the GitHub API to trigger a webhook event called
501 // repository_dispatch when you want to trigger a workflow for
502 // activity that happens outside of GitHub. For more information,
503 // see
504 // https://developer.github.com/v3/repos/#create-a-repository-dispatch-event.
505 // To trigger the custom repository_dispatch webhook event, you
506 // must send a POST request to a GitHub API endpoint and provide
507 // an event_type name to describe the activity type. To trigger a
508 // workflow run, you must also configure your workflow to use the
509 // repository_dispatch event.
510 "repository_dispatch"?: #eventObject
511
512 // You can schedule a workflow to run at specific UTC times using
513 // POSIX cron syntax
514 // (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07).
515 // You can optionally specify a timezone using an IANA timezone
516 // string
517 // (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
518 // for timezone-aware scheduling. Scheduled workflows run on the
519 // latest commit on the default or base branch. The shortest
520 // interval you can run scheduled workflows is once every 5
521 // minutes.
522 // Note: GitHub Actions does not support the non-standard syntax
523 // @yearly, @monthly, @weekly, @daily, @hourly, and @reboot.
524 // You can use crontab guru (https://crontab.guru/) to help
525 // generate your cron syntax and confirm what time it will run.
526 // To help you get started, there is also a list of crontab guru
527 // examples (https://crontab.guru/examples.html).
528 "schedule"?: [...close({
529 // A cron expression that represents a schedule. A scheduled
530 // workflow will run at most once every 5 minutes.
531 "cron"!: string
532
533 // A string that represents the time zone a scheduled workflow
534 // will run relative to in IANA format (e.g. 'America/New_York'
535 // or 'Europe/London'). If omitted, the workflow will run
536 // relative to midnight UTC.
537 "timezone"?: string
538 })] & [_, ...]
539 })])
540 "env"?: #env
541 "defaults"?: #defaults
542
543 // Concurrency ensures that only a single job or workflow using
544 // the same concurrency group will run at a time. A concurrency
545 // group can be any string or expression. The expression can use
546 // any context except for the secrets context.
547 // You can also specify concurrency at the workflow level.
548 // When a concurrent job or workflow is queued, if another job or
549 // workflow using the same concurrency group in the repository is
550 // in progress, the queued job or workflow will be pending. By
551 // default any previously pending job or workflow in the
552 // concurrency group will be canceled; this behavior can be
553 // changed with `queue`. To also cancel any currently running job
554 // or workflow in the same concurrency group, specify
555 // cancel-in-progress: true.
556 "concurrency"?: matchN(1, [string, #concurrency])
557
558 // A workflow run is made up of one or more jobs. Jobs run in
559 // parallel by default. To run jobs sequentially, you can define
560 // dependencies on other jobs using the jobs.<job_id>.needs
561 // keyword.
562 // Each job runs in a fresh instance of the virtual environment
563 // specified by runs-on.
564 // You can run an unlimited number of jobs as long as you are
565 // within the workflow usage limits. For more information, see
566 // https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#usage-limits.
567 "jobs"!: struct.MinFields(1) & close({
568 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$"]: matchN(1, [#normalJob, #reusableWorkflowCallJob])}
569 })
570
571 // The name for workflow runs generated from the workflow. GitHub
572 // displays the workflow run name in the list of workflow runs on
573 // your repository's 'Actions' tab.
574 "run-name"?: string
575 "permissions"?: #permissions
576 })
577
578 #: "permissions-event": close({
579 "actions"?: #."permissions-level"
580 "artifact-metadata"?: #."permissions-level"
581 "attestations"?: #."permissions-level"
582 "checks"?: #."permissions-level"
583 "code-quality"?: #."permissions-level"
584 "contents"?: #."permissions-level"
585 "deployments"?: #."permissions-level"
586 "discussions"?: #."permissions-level"
587 "id-token"?: #."permissions-level"
588 "issues"?: #."permissions-level"
589 "models"?: "read" | "none"
590 "packages"?: #."permissions-level"
591 "pages"?: #."permissions-level"
592 "pull-requests"?: #."permissions-level"
593 "repository-projects"?: #."permissions-level"
594 "security-events"?: #."permissions-level"
595 "statuses"?: #."permissions-level"
596 })
597
598 #: "permissions-level": "read" | "write" | "none"
599
600 // Using the working-directory keyword, you can specify the
601 // working directory of where to run the command.
602 #: "working-directory": string
603
604 #architecture: "ARM32" | "x64" | "x86"
605
606 #branch: #globs
607
608 #concurrency: close({
609 // When a concurrent job or workflow is queued, if another job or
610 // workflow using the same concurrency group in the repository is
611 // in progress, the queued job or workflow will be pending. By
612 // default any previously pending job or workflow in the
613 // concurrency group will be canceled; this behavior can be
614 // changed with `queue`.
615 "group"!: string
616
617 // To cancel any currently running job or workflow in the same
618 // concurrency group, specify cancel-in-progress: true.
619 "cancel-in-progress"?: matchN(1, [bool, #expressionSyntax])
620
621 // Controls how pending jobs or workflow runs are queued within a
622 // concurrency group. With the default `single`, at most one run
623 // can be pending — additional pending runs cancel the previous
624 // one. With `max`, up to 100 runs can be pending and are
625 // processed in FIFO order. The combination of `queue: max` and
626 // `cancel-in-progress: true` is not allowed.
627 "queue"?: "single" | "max"
628 })
629
630 #configuration: matchN(1, [string, number, bool, {
631 [string]: #configuration
632 }, [...#configuration]])
633
634 #defaults: struct.MinFields(1) & close({
635 "run"?: struct.MinFields(1) & close({
636 "shell"?: #shell
637 "working-directory"?: #."working-directory"
638 })
639 })
640
641 // To set custom environment variables, you need to specify the
642 // variables in the workflow file. You can define environment
643 // variables for a step, job, or entire workflow using the
644 // jobs.<job_id>.steps[*].env, jobs.<job_id>.env, and env
645 // keywords. For more information, see
646 // https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsenv
647 #env: matchN(1, [{
648 [string]: bool | number | string
649 }, #stringContainingExpressionSyntax])
650
651 // The environment that the job references
652 #environment: close({
653 // The name of the environment configured in the repo.
654 "name"!: string
655
656 // A deployment URL
657 "url"?: string
658
659 // Whether to create a deployment for this job. Setting to false
660 // lets the job use environment secrets and variables without
661 // creating a deployment record. Wait timers and required
662 // reviewers still apply.
663 "deployment"?: matchN(1, [bool, #expressionSyntax])
664 })
665
666 #event: "branch_protection_rule" | "check_run" | "check_suite" | "create" | "delete" | "deployment" | "deployment_status" | "discussion" | "discussion_comment" | "fork" | "gollum" | "issue_comment" | "issues" | "label" | "merge_group" | "milestone" | "page_build" | "project" | "project_card" | "project_column" | "public" | "pull_request" | "pull_request_review" | "pull_request_review_comment" | "pull_request_target" | "push" | "registry_package" | "release" | "status" | "watch" | "workflow_call" | "workflow_dispatch" | "workflow_run" | "repository_dispatch"
667
668 #eventObject: null | {
669 ...
670 }
671
672 #expressionSyntax: =~"""
673 ^\\$\\{\\{(.|[\r
674 ])*\\}\\}$
675 """
676
677 #globs: [...strings.MinRunes(1)] & [_, ...]
678
679 #jobContainer: close({
680 // The Docker image to use as the container to run the action. The
681 // value can be the Docker Hub image name or a registry name.
682 "image"!: string
683
684 // If the image's container registry requires authentication to
685 // pull the image, you can use credentials to set a map of the
686 // username and password. The credentials are the same values
687 // that you would provide to the `docker login` command.
688 "credentials"?: {
689 "username"?: string
690 "password"?: string
691 ...
692 }
693 "env"?: #env
694
695 // Sets an array of ports to expose on the container.
696 "ports"?: [...number | string] & [_, ...]
697
698 // Sets an array of volumes for the container to use. You can use
699 // volumes to share data between services or other steps in a
700 // job. You can specify named Docker volumes, anonymous Docker
701 // volumes, or bind mounts on the host.
702 // To specify a volume, you specify the source and destination
703 // path: <source>:<destinationPath>
704 // The <source> is a volume name or an absolute path on the host
705 // machine, and <destinationPath> is an absolute path in the
706 // container.
707 "volumes"?: [...string] & [_, ...]
708
709 // Additional Docker container resource options. For a list of
710 // options, see
711 // https://docs.docker.com/engine/reference/commandline/create/#options.
712 "options"?: string
713 })
714
715 // Identifies any jobs that must complete successfully before this
716 // job will run. It can be a string or array of strings. If a job
717 // fails, all jobs that need it are skipped unless the jobs use a
718 // conditional statement that causes the job to continue.
719 #jobNeeds: matchN(1, [[...#name] & [_, ...], #name])
720
721 #machine: "linux" | "macos" | "windows"
722
723 // A build matrix is a set of different configurations of the
724 // virtual environment. For example you might run a job against
725 // more than one supported version of a language, operating
726 // system, or tool. Each configuration is a copy of the job that
727 // runs and reports a status.
728 // You can specify a matrix by supplying an array for the
729 // configuration options. For example, if the GitHub virtual
730 // environment supports Node.js versions 6, 8, and 10 you could
731 // specify an array of those versions in the matrix.
732 // When you define a matrix of operating systems, you must set the
733 // required runs-on keyword to the operating system of the
734 // current job, rather than hard-coding the operating system
735 // name. To access the operating system name, you can use the
736 // matrix.os context parameter to set runs-on. For more
737 // information, see
738 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.
739 #matrix: matchN(1, [struct.MinFields(1) & {
740 {[=~"^(in|ex)clude$"]: matchN(1, [#expressionSyntax, [...{
741 [string]: #configuration
742 }] & [_, ...]])
743 }
744 {[!~"^(in|ex)clude$" & !~"^()$"]: matchN(1, [[...#configuration] & [_, ...], #expressionSyntax])}
745 }, #expressionSyntax])
746
747 #name: =~"^[_a-zA-Z][a-zA-Z0-9_-]*$"
748
749 // Each job must have an id to associate with the job. The key
750 // job_id is a string and its value is a map of the job's
751 // configuration data. You must replace <job_id> with a string
752 // that is unique to the jobs object. The <job_id> must start
753 // with a letter or _ and contain only alphanumeric characters,
754 // -, or _.
755 #normalJob: close({
756 // The name of the job displayed on GitHub.
757 "name"?: string
758 "needs"?: #jobNeeds
759 "snapshot"?: #snapshot
760 "permissions"?: #permissions
761
762 // The type of machine to run the job on. The machine can be
763 // either a GitHub-hosted runner, or a self-hosted runner.
764 "runs-on"!: matchN(>=1, [string, [string, ...string] & [_, ...] & [...], {
765 "group"?: string
766 "labels"?: matchN(1, [string, [...string]])
767 ...
768 }, #stringContainingExpressionSyntax, #expressionSyntax])
769
770 // The environment that the job references.
771 "environment"?: matchN(1, [string, #environment])
772
773 // A map of outputs for a job. Job outputs are available to all
774 // downstream jobs that depend on this job.
775 "outputs"?: struct.MinFields(1) & {
776 [string]: string
777 }
778 "env"?: #env
779 "defaults"?: #defaults
780
781 // You can use the if conditional to prevent a job from running
782 // unless a condition is met. You can use any supported context
783 // and expression to create a conditional.
784 // Expressions in an if conditional do not require the ${{ }}
785 // syntax. For more information, see
786 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.
787 "if"?: bool | number | string
788
789 // A job contains a sequence of tasks called steps. Steps can run
790 // commands, run setup tasks, or run an action in your
791 // repository, a public repository, or an action published in a
792 // Docker registry. Not all steps run actions, but all actions
793 // run as a step. Each step runs in its own process in the
794 // virtual environment and has access to the workspace and
795 // filesystem. Because steps run in their own process, changes to
796 // environment variables are not preserved between steps. GitHub
797 // provides built-in steps to set up and complete a job.
798 // Must contain either `uses` or `run`
799 "steps"?: [...#step] & [_, ...]
800
801 // The maximum number of minutes to let a workflow run before
802 // GitHub automatically cancels it. Default: 360
803 "timeout-minutes"?: matchN(1, [number, #expressionSyntax])
804
805 // A strategy creates a build matrix for your jobs. You can define
806 // different variations of an environment to run each job in.
807 "strategy"?: close({
808 "matrix"!: #matrix
809
810 // When set to true, GitHub cancels all in-progress jobs if any
811 // matrix job fails. Default: true
812 "fail-fast"?: bool | string
813
814 // The maximum number of jobs that can run simultaneously when
815 // using a matrix job strategy. By default, GitHub will maximize
816 // the number of jobs run in parallel depending on the available
817 // runners on GitHub-hosted virtual machines.
818 "max-parallel"?: number | string
819 })
820
821 // Prevents a workflow run from failing when a job fails. Set to
822 // true to allow a workflow run to pass when this job fails.
823 "continue-on-error"?: matchN(1, [bool, #expressionSyntax])
824
825 // A container to run any steps in a job that don't already
826 // specify a container. If you have steps that use both script
827 // and container actions, the container actions will run as
828 // sibling containers on the same network with the same volume
829 // mounts.
830 // If you do not set a container, all steps will run directly on
831 // the host specified by runs-on unless a step refers to an
832 // action configured to run in a container.
833 "container"?: matchN(1, [string, #jobContainer])
834
835 // Additional containers to host services for a job in a workflow.
836 // These are useful for creating databases or cache services like
837 // redis. The runner on the virtual machine will automatically
838 // create a network and manage the life cycle of the service
839 // containers.
840 // When you use a service container for a job or your step uses
841 // container actions, you don't need to set port information to
842 // access the service. Docker automatically exposes all ports
843 // between containers on the same network.
844 // When both the job and the action run in a container, you can
845 // directly reference the container by its hostname. The hostname
846 // is automatically mapped to the service name.
847 // When a step does not use a container action, you must access
848 // the service using localhost and bind the ports.
849 "services"?: {
850 [string]: #serviceContainer
851 }
852
853 // Concurrency ensures that only a single job or workflow using
854 // the same concurrency group will run at a time. A concurrency
855 // group can be any string or expression. The expression can use
856 // any context except for the secrets context.
857 // You can also specify concurrency at the workflow level.
858 // When a concurrent job or workflow is queued, if another job or
859 // workflow using the same concurrency group in the repository is
860 // in progress, the queued job or workflow will be pending. By
861 // default any previously pending job or workflow in the
862 // concurrency group will be canceled; this behavior can be
863 // changed with `queue`. To also cancel any currently running job
864 // or workflow in the same concurrency group, specify
865 // cancel-in-progress: true.
866 "concurrency"?: matchN(1, [string, #concurrency])
867 })
868
869 #path: #globs
870
871 // You can modify the default permissions granted to the
872 // GITHUB_TOKEN, adding or removing access as required, so that
873 // you only allow the minimum required access.
874 #permissions: matchN(1, ["read-all" | "write-all", #."permissions-event"])
875
876 // Each job must have an id to associate with the job. The key
877 // job_id is a string and its value is a map of the job's
878 // configuration data. You must replace <job_id> with a string
879 // that is unique to the jobs object. The <job_id> must start
880 // with a letter or _ and contain only alphanumeric characters,
881 // -, or _.
882 #reusableWorkflowCallJob: close({
883 // The name of the job displayed on GitHub.
884 "name"?: string
885 "needs"?: #jobNeeds
886 "permissions"?: #permissions
887
888 // You can use the if conditional to prevent a job from running
889 // unless a condition is met. You can use any supported context
890 // and expression to create a conditional.
891 // Expressions in an if conditional do not require the ${{ }}
892 // syntax. For more information, see
893 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.
894 "if"?: bool | number | string
895
896 // The location and version of a reusable workflow file to run as
897 // a job, of the form './{path/to}/{localfile}.yml' or
898 // '{owner}/{repo}/{path}/{filename}@{ref}'. {ref} can be a SHA,
899 // a release tag, or a branch name. Using the commit SHA is the
900 // safest for stability and security.
901 "uses"!: =~"^(.+\\/)+(.+)\\.(ya?ml)(@.+)?$"
902 "with"?: #env
903
904 // When a job is used to call a reusable workflow, you can use
905 // 'secrets' to provide a map of secrets that are passed to the
906 // called workflow. Any secrets that you pass must match the
907 // names defined in the called workflow.
908 "secrets"?: matchN(1, [#env, "inherit"])
909
910 // A strategy creates a build matrix for your jobs. You can define
911 // different variations of an environment to run each job in.
912 "strategy"?: close({
913 "matrix"!: #matrix
914
915 // When set to true, GitHub cancels all in-progress jobs if any
916 // matrix job fails. Default: true
917 "fail-fast"?: bool | string
918
919 // The maximum number of jobs that can run simultaneously when
920 // using a matrix job strategy. By default, GitHub will maximize
921 // the number of jobs run in parallel depending on the available
922 // runners on GitHub-hosted virtual machines.
923 "max-parallel"?: number | string
924 })
925
926 // Concurrency ensures that only a single job or workflow using
927 // the same concurrency group will run at a time. A concurrency
928 // group can be any string or expression. The expression can use
929 // any context except for the secrets context.
930 // You can also specify concurrency at the workflow level.
931 // When a concurrent job or workflow is queued, if another job or
932 // workflow using the same concurrency group in the repository is
933 // in progress, the queued job or workflow will be pending. By
934 // default any previously pending job or workflow in the
935 // concurrency group will be canceled; this behavior can be
936 // changed with `queue`. To also cancel any currently running job
937 // or workflow in the same concurrency group, specify
938 // cancel-in-progress: true.
939 "concurrency"?: matchN(1, [string, #concurrency])
940 })
941
942 #serviceContainer: close({
943 // The Docker image to use as the service container to run the
944 // action. The value can be the Docker Hub image name or a
945 // registry name.
946 "image"!: string
947
948 // If the image's container registry requires authentication to
949 // pull the image, you can use credentials to set a map of the
950 // username and password. The credentials are the same values
951 // that you would provide to the `docker login` command.
952 "credentials"?: {
953 "username"?: string
954 "password"?: string
955 ...
956 }
957 "env"?: #env
958
959 // Sets an array of ports to expose on the service container.
960 "ports"?: [...number | string] & [_, ...]
961
962 // Sets an array of volumes for the service container to use. You
963 // can use volumes to share data between services or other steps
964 // in a job. You can specify named Docker volumes, anonymous
965 // Docker volumes, or bind mounts on the host.
966 // To specify a volume, you specify the source and destination
967 // path: <source>:<destinationPath>
968 // The <source> is a volume name or an absolute path on the host
969 // machine, and <destinationPath> is an absolute path in the
970 // container.
971 "volumes"?: [...string] & [_, ...]
972
973 // Additional Docker container resource options. For a list of
974 // options, see
975 // https://docs.docker.com/engine/reference/commandline/create/#options.
976 "options"?: string
977
978 // Overrides the Docker image's default command (`CMD`). The value
979 // is passed as arguments after the image name in the `docker
980 // create` command. If you also specify `entrypoint`, `command`
981 // provides the arguments to that entrypoint.
982 "command"?: string
983
984 // Overrides the Docker image's default `ENTRYPOINT`. The value is
985 // a single string defining the executable to run. Use this when
986 // you need to replace the image's entrypoint entirely. You can
987 // combine `entrypoint` with `command` to pass arguments to the
988 // custom entrypoint.
989 "entrypoint"?: string
990 })
991
992 // You can override the default shell settings in the runner's
993 // operating system using the shell keyword. You can use built-in
994 // shell keywords, or you can define a custom set of shell
995 // options.
996 #shell: matchN(>=1, [string, "bash" | "pwsh" | "python" | "sh" | "cmd" | "powershell"])
997
998 // You can use `jobs.<job_id>.snapshot` to generate a custom
999 // image.
1000 // Add the snapshot keyword to the job, using either the string
1001 // syntax or mapping syntax as shown in
1002 // https://docs.github.com/en/actions/how-tos/manage-runners/larger-runners/use-custom-images#generating-a-custom-image.
1003 // Each job that includes the snapshot keyword creates a separate
1004 // image. To generate only one image or image version, include
1005 // all workflow steps in a single job. Each successful run of a
1006 // job that includes the snapshot keyword creates a new version
1007 // of that image.
1008 // For more information, see
1009 // https://docs.github.com/en/actions/how-tos/manage-runners/larger-runners/use-custom-images.
1010 #snapshot: matchN(1, [string, close({
1011 "image-name"!: string
1012 "version"?: =~"^\\d+(\\.\\d+|\\*)?$"
1013 })])
1014
1015 #step: matchN(1, [{
1016 "uses"!: _
1017 ...
1018 }, {
1019 "run"!: _
1020 ...
1021 }, {
1022 "wait"!: _
1023 ...
1024 }, {
1025 "wait-all"!: _
1026 ...
1027 }, {
1028 "cancel"!: _
1029 ...
1030 }, {
1031 "parallel"!: _
1032 ...
1033 }]) & close({
1034 _t0="working-directory"?: _
1035 if _t0 != _|_ {
1036 "run"!: _
1037 }
1038 shell?: _
1039 if shell != _|_ {
1040 "run"!: _
1041 }
1042 {}
1043
1044 // A unique identifier for the step. You can use the id to
1045 // reference the step in contexts. For more information, see
1046 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.
1047 "id"?: string
1048
1049 // You can use the if conditional to prevent a step from running
1050 // unless a condition is met. You can use any supported context
1051 // and expression to create a conditional.
1052 // Expressions in an if conditional do not require the ${{ }}
1053 // syntax. For more information, see
1054 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.
1055 "if"?: bool | number | string
1056
1057 // A name for your step to display on GitHub.
1058 "name"?: string
1059
1060 // Selects an action to run as part of a step in your job. An
1061 // action is a reusable unit of code. You can use an action
1062 // defined in the same repository as the workflow, a public
1063 // repository, or in a published Docker container image
1064 // (https://hub.docker.com/).
1065 // We strongly recommend that you include the version of the
1066 // action you are using by specifying a Git ref, SHA, or Docker
1067 // tag number. If you don't specify a version, it could break
1068 // your workflows or cause unexpected behavior when the action
1069 // owner publishes an update.
1070 // - Using the commit SHA of a released action version is the
1071 // safest for stability and security.
1072 // - Using the specific major action version allows you to receive
1073 // critical fixes and security patches while still maintaining
1074 // compatibility. It also assures that your workflow should still
1075 // work.
1076 // - Using the master branch of an action may be convenient, but
1077 // if someone releases a new major version with a breaking
1078 // change, your workflow could break.
1079 // Some actions require inputs that you must set using the with
1080 // keyword. Review the action's README file to determine the
1081 // inputs required.
1082 // Actions are either JavaScript files or Docker containers. If
1083 // the action you're using is a Docker container you must run the
1084 // job in a Linux virtual environment. For more details, see
1085 // https://help.github.com/en/articles/virtual-environments-for-github-actions.
1086 "uses"?: string
1087
1088 // Runs command-line programs using the operating system's shell.
1089 // If you do not provide a name, the step name will default to
1090 // the text specified in the run command.
1091 // Commands run using non-login shells by default. You can choose
1092 // a different shell and customize the shell used to run
1093 // commands. For more information, see
1094 // https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#using-a-specific-shell.
1095 // Each run keyword represents a new process and shell in the
1096 // virtual environment. When you provide multi-line commands,
1097 // each line runs in the same shell.
1098 "run"?: string
1099 "working-directory"?: #."working-directory"
1100 "shell"?: #shell
1101 "with"?: #env
1102 "env"?: #env
1103
1104 // Prevents a job from failing when a step fails. Set to true to
1105 // allow a job to pass when this step fails.
1106 "continue-on-error"?: matchN(1, [bool, #expressionSyntax])
1107
1108 // The maximum number of minutes to run the step before killing
1109 // the process.
1110 "timeout-minutes"?: matchN(1, [number, #expressionSyntax])
1111
1112 // Runs a step asynchronously so the job continues to the next
1113 // step without waiting for it to finish. You can use background
1114 // on steps that use run or uses. To reference a background step
1115 // from wait or cancel, give it an id. A maximum of 10 background
1116 // steps can run concurrently in a single job.
1117 "background"?: bool
1118
1119 // Pauses the job until one or more background steps complete.
1120 // Provide a single step id as a string, or multiple step ids as
1121 // an array. After a wait step completes, the outputs of the
1122 // referenced background steps become available to subsequent
1123 // steps.
1124 "wait"?: matchN(1, [string, [...string] & [_, ...]])
1125
1126 // Pauses the job until all active background steps complete. The
1127 // wait-all keyword takes no arguments.
1128 "wait-all"?: null | bool
1129
1130 // Gracefully terminates a running background step. The runner
1131 // sends the step's process a termination signal (SIGTERM) so it
1132 // can clean up. The cancel keyword targets a single background
1133 // step by its id.
1134 "cancel"?: string
1135
1136 // Runs a group of steps concurrently, then waits for all of them
1137 // to finish before continuing. Every step in the group runs as a
1138 // background step, with an implicit wait at the end of the
1139 // group.
1140 "parallel"?: [...#step] & [_, ...]
1141 })
1142
1143 #stringContainingExpressionSyntax: =~"""
1144 ^.*\\$\\{\\{(.|[\r
1145 ])*\\}\\}.*$
1146 """
1147
1148 // Selects the types of activity that will trigger a workflow run.
1149 // Most GitHub events are triggered by more than one type of
1150 // activity. For example, the event for the release resource is
1151 // triggered when a release is published, unpublished, created,
1152 // edited, deleted, or prereleased. The types keyword enables you
1153 // to narrow down activity that causes the workflow to run. When
1154 // only one activity type triggers a webhook event, the types
1155 // keyword is unnecessary.
1156 // You can use an array of event types. For more information about
1157 // each event and their activity types, see
1158 // https://help.github.com/en/articles/events-that-trigger-workflows#webhook-events.
1159 #types: matchN(1, [[_, ...], string])
1160
1161 // A string identifier to associate with the input. The value of
1162 // <input_id> is a map of the input's metadata. The <input_id>
1163 // must be a unique identifier within the inputs object. The
1164 // <input_id> must start with a letter or _ and contain only
1165 // alphanumeric characters, -, or _.
1166 #workflowDispatchInput: matchN(5, [matchIf({
1167 "type"!: "string"
1168 ...
1169 }, {
1170 "default"?: string
1171 ...
1172 }, _) & {
1173 ...
1174 }, matchIf({
1175 "type"!: "boolean"
1176 ...
1177 }, {
1178 "default"?: bool
1179 ...
1180 }, _) & {
1181 ...
1182 }, matchIf({
1183 "type"!: "number"
1184 ...
1185 }, {
1186 "default"?: number
1187 ...
1188 }, _) & {
1189 ...
1190 }, matchIf({
1191 "type"!: "environment"
1192 ...
1193 }, {
1194 "default"?: string
1195 ...
1196 }, _) & {
1197 ...
1198 }, matchIf({
1199 "type"!: "choice"
1200 ...
1201 }, {
1202 "options"!: _
1203 ...
1204 }, _) & {
1205 ...
1206 }]) & close({
1207 // A string description of the input parameter.
1208 "description"?: string
1209
1210 // A string shown to users using the deprecated input.
1211 "deprecationMessage"?: string
1212
1213 // A boolean to indicate whether the action requires the input
1214 // parameter. Set to true when the parameter is required.
1215 "required"?: bool
1216
1217 // A string representing the default value. The default value is
1218 // used when an input parameter isn't specified in a workflow
1219 // file.
1220 "default"?: _
1221
1222 // A string representing the type of the input.
1223 "type"?: "string" | "choice" | "boolean" | "number" | "environment"
1224
1225 // The options of the dropdown list, if the type is a choice.
1226 "options"?: [...string] & [_, ...]
1227 })
1228}