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