@intentius/chant-lexicon-github 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/integrity.json +31 -0
  2. package/dist/manifest.json +15 -0
  3. package/dist/meta.json +135 -0
  4. package/dist/rules/deprecated-action-version.ts +49 -0
  5. package/dist/rules/detect-secrets.ts +53 -0
  6. package/dist/rules/extract-inline-structs.ts +62 -0
  7. package/dist/rules/file-job-limit.ts +49 -0
  8. package/dist/rules/gha006.ts +58 -0
  9. package/dist/rules/gha009.ts +42 -0
  10. package/dist/rules/gha011.ts +40 -0
  11. package/dist/rules/gha017.ts +32 -0
  12. package/dist/rules/gha018.ts +40 -0
  13. package/dist/rules/gha019.ts +72 -0
  14. package/dist/rules/job-timeout.ts +59 -0
  15. package/dist/rules/missing-recommended-inputs.ts +61 -0
  16. package/dist/rules/no-hardcoded-secrets.ts +46 -0
  17. package/dist/rules/no-raw-expressions.ts +51 -0
  18. package/dist/rules/suggest-cache.ts +71 -0
  19. package/dist/rules/use-condition-builders.ts +45 -0
  20. package/dist/rules/use-matrix-builder.ts +44 -0
  21. package/dist/rules/use-typed-actions.ts +47 -0
  22. package/dist/rules/validate-concurrency.ts +66 -0
  23. package/dist/rules/yaml-helpers.ts +129 -0
  24. package/dist/skills/chant-github.md +29 -0
  25. package/dist/skills/github-actions-patterns.md +93 -0
  26. package/dist/types/index.d.ts +358 -0
  27. package/package.json +33 -0
  28. package/src/codegen/docs-cli.ts +3 -0
  29. package/src/codegen/docs.ts +1138 -0
  30. package/src/codegen/generate-cli.ts +36 -0
  31. package/src/codegen/generate-lexicon.ts +58 -0
  32. package/src/codegen/generate-typescript.ts +149 -0
  33. package/src/codegen/generate.ts +141 -0
  34. package/src/codegen/naming.ts +57 -0
  35. package/src/codegen/package.ts +65 -0
  36. package/src/codegen/parse.ts +700 -0
  37. package/src/codegen/patches.ts +46 -0
  38. package/src/composites/cache.ts +25 -0
  39. package/src/composites/checkout.ts +31 -0
  40. package/src/composites/composites.test.ts +675 -0
  41. package/src/composites/deploy-environment.ts +77 -0
  42. package/src/composites/docker-build.ts +120 -0
  43. package/src/composites/download-artifact.ts +24 -0
  44. package/src/composites/go-ci.ts +91 -0
  45. package/src/composites/index.ts +26 -0
  46. package/src/composites/node-ci.ts +71 -0
  47. package/src/composites/node-pipeline.ts +151 -0
  48. package/src/composites/python-ci.ts +92 -0
  49. package/src/composites/setup-go.ts +24 -0
  50. package/src/composites/setup-node.ts +26 -0
  51. package/src/composites/setup-python.ts +24 -0
  52. package/src/composites/upload-artifact.ts +27 -0
  53. package/src/coverage.ts +49 -0
  54. package/src/expression.test.ts +147 -0
  55. package/src/expression.ts +214 -0
  56. package/src/generated/index.d.ts +358 -0
  57. package/src/generated/index.ts +29 -0
  58. package/src/generated/lexicon-github.json +135 -0
  59. package/src/generated/runtime.ts +4 -0
  60. package/src/import/generator.test.ts +110 -0
  61. package/src/import/generator.ts +119 -0
  62. package/src/import/parser.test.ts +98 -0
  63. package/src/import/parser.ts +73 -0
  64. package/src/index.ts +53 -0
  65. package/src/lint/post-synth/gha006.ts +58 -0
  66. package/src/lint/post-synth/gha009.ts +42 -0
  67. package/src/lint/post-synth/gha011.ts +40 -0
  68. package/src/lint/post-synth/gha017.ts +32 -0
  69. package/src/lint/post-synth/gha018.ts +40 -0
  70. package/src/lint/post-synth/gha019.ts +72 -0
  71. package/src/lint/post-synth/post-synth.test.ts +318 -0
  72. package/src/lint/post-synth/yaml-helpers.ts +129 -0
  73. package/src/lint/rules/data/deprecated-versions.ts +13 -0
  74. package/src/lint/rules/data/known-actions.ts +13 -0
  75. package/src/lint/rules/data/recommended-inputs.ts +10 -0
  76. package/src/lint/rules/data/secret-patterns.ts +31 -0
  77. package/src/lint/rules/deprecated-action-version.ts +49 -0
  78. package/src/lint/rules/detect-secrets.ts +53 -0
  79. package/src/lint/rules/extract-inline-structs.ts +62 -0
  80. package/src/lint/rules/file-job-limit.ts +49 -0
  81. package/src/lint/rules/index.ts +17 -0
  82. package/src/lint/rules/job-timeout.ts +59 -0
  83. package/src/lint/rules/missing-recommended-inputs.ts +61 -0
  84. package/src/lint/rules/no-hardcoded-secrets.ts +46 -0
  85. package/src/lint/rules/no-raw-expressions.ts +51 -0
  86. package/src/lint/rules/rules.test.ts +365 -0
  87. package/src/lint/rules/suggest-cache.ts +71 -0
  88. package/src/lint/rules/use-condition-builders.ts +45 -0
  89. package/src/lint/rules/use-matrix-builder.ts +44 -0
  90. package/src/lint/rules/use-typed-actions.ts +47 -0
  91. package/src/lint/rules/validate-concurrency.ts +66 -0
  92. package/src/lsp/completions.test.ts +9 -0
  93. package/src/lsp/completions.ts +20 -0
  94. package/src/lsp/hover.test.ts +9 -0
  95. package/src/lsp/hover.ts +38 -0
  96. package/src/package-cli.ts +42 -0
  97. package/src/plugin.test.ts +128 -0
  98. package/src/plugin.ts +408 -0
  99. package/src/serializer.test.ts +270 -0
  100. package/src/serializer.ts +383 -0
  101. package/src/skills/github-actions-patterns.md +93 -0
  102. package/src/spec/fetch.ts +55 -0
  103. package/src/validate-cli.ts +19 -0
  104. package/src/validate.test.ts +12 -0
  105. package/src/validate.ts +32 -0
  106. package/src/variables.ts +44 -0
@@ -0,0 +1,358 @@
1
+ // Code generated by chant github generate. DO NOT EDIT.
2
+
3
+ // --- GitHub Actions Entity classes ---
4
+
5
+ export declare class Concurrency {
6
+ constructor(props: {
7
+ /** When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled. */
8
+ group: string;
9
+ /** To cancel any currently running job or workflow in the same concurrency group, specify cancel-in-progress: true. */
10
+ "cancel-in-progress"?: boolean | string;
11
+ });
12
+ }
13
+
14
+ export declare class Container {
15
+ constructor(props: {
16
+ /** The Docker image to use as the container to run the action. The value can be the Docker Hub image name or a registry name. */
17
+ image: string;
18
+ /** If the image's container registry requires authentication to pull the image, you can use credentials to set a map of the username and password. The credentials are the same values that you would provide to the `docker login` command. */
19
+ credentials?: Record<string, unknown>;
20
+ /** Sets an array of environment variables in the container. */
21
+ env?: any;
22
+ /** Additional Docker container resource options. For a list of options, see https://docs.docker.com/engine/reference/commandline/create/#options. */
23
+ options?: string;
24
+ /** Sets an array of ports to expose on the container. */
25
+ ports?: (number | string)[];
26
+ /** Sets an array of volumes for the container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host.
27
+ To specify a volume, you specify the source and destination path: <source>:<destinationPath>
28
+ The <source> is a volume name or an absolute path on the host machine, and <destinationPath> is an absolute path in the container. */
29
+ volumes?: string[];
30
+ });
31
+ }
32
+
33
+ export declare class Defaults {
34
+ constructor(props: {
35
+ run?: Record<string, unknown>;
36
+ });
37
+ }
38
+
39
+ export declare class Environment {
40
+ constructor(props: {
41
+ /** The name of the environment configured in the repo. */
42
+ name: string;
43
+ /** A deployment URL */
44
+ url?: string;
45
+ });
46
+ }
47
+
48
+ export declare class Job {
49
+ constructor(props: {
50
+ /** The type of machine to run the job on. The machine can be either a GitHub-hosted runner, or a self-hosted runner. */
51
+ "runs-on": string | string[];
52
+ /** Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the secrets context.
53
+ You can also specify concurrency at the workflow level.
54
+ When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled. To also cancel any currently running job or workflow in the same concurrency group, specify cancel-in-progress: true. */
55
+ concurrency?: Concurrency | string;
56
+ /** A container to run any steps in a job that don't already specify a container. If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts.
57
+ If you do not set a container, all steps will run directly on the host specified by runs-on unless a step refers to an action configured to run in a container. */
58
+ container?: Container | string;
59
+ /** Prevents a workflow run from failing when a job fails. Set to true to allow a workflow run to pass when this job fails. */
60
+ "continue-on-error"?: boolean;
61
+ /** A map of default settings that will apply to all steps in the job. */
62
+ defaults?: Defaults;
63
+ /** A map of environment variables that are available to all steps in the job. */
64
+ env?: Record<string, string>;
65
+ /** The environment that the job references. */
66
+ environment?: Environment | string;
67
+ /** You can use the if conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional.
68
+ Expressions in an if conditional do not require the ${{ }} syntax. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions. */
69
+ if?: string;
70
+ /** The name of the job displayed on GitHub. */
71
+ name?: string;
72
+ needs?: string[];
73
+ /** A map of outputs for a job. Job outputs are available to all downstream jobs that depend on this job. */
74
+ outputs?: Record<string, string>;
75
+ permissions?: Permissions | string;
76
+ /** Additional containers to host services for a job in a workflow. These are useful for creating databases or cache services like redis. The runner on the virtual machine will automatically create a network and manage the life cycle of the service containers.
77
+ When you use a service container for a job or your step uses container actions, you don't need to set port information to access the service. Docker automatically exposes all ports between containers on the same network.
78
+ When both the job and the action run in a container, you can directly reference the container by its hostname. The hostname is automatically mapped to the service name.
79
+ When a step does not use a container action, you must access the service using localhost and bind the ports. */
80
+ services?: Record<string, Service>;
81
+ snapshot?: any;
82
+ /** A job contains a sequence of tasks called steps. Steps can run commands, run setup tasks, or run an action in your repository, a public repository, or an action published in a Docker registry. Not all steps run actions, but all actions run as a step. Each step runs in its own process in the virtual environment and has access to the workspace and filesystem. Because steps run in their own process, changes to environment variables are not preserved between steps. GitHub provides built-in steps to set up and complete a job.
83
+ Must contain either `uses` or `run`
84
+ */
85
+ steps?: Step[];
86
+ /** A strategy creates a build matrix for your jobs. You can define different variations of an environment to run each job in. */
87
+ strategy?: Strategy;
88
+ /** The maximum number of minutes to let a workflow run before GitHub automatically cancels it. Default: 360 */
89
+ "timeout-minutes"?: number;
90
+ });
91
+ }
92
+
93
+ export declare class Permissions {
94
+ constructor(props: {
95
+ actions?: "read" | "write" | "none";
96
+ "artifact-metadata"?: "read" | "write" | "none";
97
+ attestations?: "read" | "write" | "none";
98
+ checks?: "read" | "write" | "none";
99
+ contents?: "read" | "write" | "none";
100
+ deployments?: "read" | "write" | "none";
101
+ discussions?: "read" | "write" | "none";
102
+ "id-token"?: "read" | "write" | "none";
103
+ issues?: "read" | "write" | "none";
104
+ models?: "read" | "none";
105
+ packages?: "read" | "write" | "none";
106
+ pages?: "read" | "write" | "none";
107
+ "pull-requests"?: "read" | "write" | "none";
108
+ "repository-projects"?: "read" | "write" | "none";
109
+ "security-events"?: "read" | "write" | "none";
110
+ statuses?: "read" | "write" | "none";
111
+ });
112
+ }
113
+
114
+ export declare class PullRequestTargetTrigger {
115
+ constructor(props: {
116
+ branches?: string[];
117
+ "branches-ignore"?: string[];
118
+ paths?: string[];
119
+ "paths-ignore"?: string[];
120
+ types?: string[];
121
+ });
122
+ }
123
+
124
+ export declare class PullRequestTrigger {
125
+ constructor(props: {
126
+ branches?: string[];
127
+ "branches-ignore"?: string[];
128
+ paths?: string[];
129
+ "paths-ignore"?: string[];
130
+ types?: string[];
131
+ });
132
+ }
133
+
134
+ export declare class PushTrigger {
135
+ constructor(props: {
136
+ branches?: string[];
137
+ "branches-ignore"?: string[];
138
+ paths?: string[];
139
+ "paths-ignore"?: string[];
140
+ tags?: string[];
141
+ "tags-ignore"?: string[];
142
+ });
143
+ }
144
+
145
+ export declare class RepositoryDispatchTrigger {
146
+ constructor(props: {
147
+ types?: string[];
148
+ });
149
+ }
150
+
151
+ export declare class ReusableWorkflowCallJob {
152
+ constructor(props: {
153
+ /** The location and version of a reusable workflow file to run as a job, of the form './{path/to}/{localfile}.yml' or '{owner}/{repo}/{path}/{filename}@{ref}'. {ref} can be a SHA, a release tag, or a branch name. Using the commit SHA is the safest for stability and security. */
154
+ uses: string;
155
+ /** Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the secrets context.
156
+ You can also specify concurrency at the workflow level.
157
+ When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled. To also cancel any currently running job or workflow in the same concurrency group, specify cancel-in-progress: true. */
158
+ concurrency?: string | Record<string, any>;
159
+ /** You can use the if conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional.
160
+ Expressions in an if conditional do not require the ${{ }} syntax. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions. */
161
+ if?: boolean;
162
+ /** The name of the job displayed on GitHub. */
163
+ name?: string;
164
+ needs?: any;
165
+ permissions?: any;
166
+ /** When a job is used to call a reusable workflow, you can use 'secrets' to provide a map of secrets that are passed to the called workflow. Any secrets that you pass must match the names defined in the called workflow. */
167
+ secrets?: "inherit";
168
+ /** A strategy creates a build matrix for your jobs. You can define different variations of an environment to run each job in. */
169
+ strategy?: Record<string, unknown>;
170
+ /** A map of inputs that are passed to the called workflow. Any inputs that you pass must match the input specifications defined in the called workflow. Unlike 'jobs.<job_id>.steps[*].with', the inputs you pass with 'jobs.<job_id>.with' are not be available as environment variables in the called workflow. Instead, you can reference the inputs by using the inputs context. */
171
+ with?: any;
172
+ });
173
+ }
174
+
175
+ export declare class ScheduleTrigger {
176
+ constructor(props: {
177
+ /** POSIX cron expression */
178
+ cron: string;
179
+ });
180
+ }
181
+
182
+ export declare class Service {
183
+ constructor(props: {
184
+ /** The Docker image to use as the container to run the action. The value can be the Docker Hub image name or a registry name. */
185
+ image: string;
186
+ /** If the image's container registry requires authentication to pull the image, you can use credentials to set a map of the username and password. The credentials are the same values that you would provide to the `docker login` command. */
187
+ credentials?: Record<string, unknown>;
188
+ /** Sets an array of environment variables in the container. */
189
+ env?: any;
190
+ /** Additional Docker container resource options. For a list of options, see https://docs.docker.com/engine/reference/commandline/create/#options. */
191
+ options?: string;
192
+ /** Sets an array of ports to expose on the container. */
193
+ ports?: (number | string)[];
194
+ /** Sets an array of volumes for the container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host.
195
+ To specify a volume, you specify the source and destination path: <source>:<destinationPath>
196
+ The <source> is a volume name or an absolute path on the host machine, and <destinationPath> is an absolute path in the container. */
197
+ volumes?: string[];
198
+ });
199
+ }
200
+
201
+ export declare class Step {
202
+ constructor(props: {
203
+ /** Continue on error */
204
+ "continue-on-error"?: boolean;
205
+ /** Environment variables */
206
+ env?: Record<string, string>;
207
+ /** Step ID for output references */
208
+ id?: string;
209
+ /** Conditional expression */
210
+ if?: string;
211
+ /** Step display name */
212
+ name?: string;
213
+ /** Shell command */
214
+ run?: string;
215
+ /** Shell to use */
216
+ shell?: string;
217
+ /** Timeout in minutes */
218
+ "timeout-minutes"?: number;
219
+ /** Action reference */
220
+ uses?: string;
221
+ /** Action inputs */
222
+ with?: Record<string, string>;
223
+ /** Working directory */
224
+ "working-directory"?: string;
225
+ });
226
+ }
227
+
228
+ export declare class Strategy {
229
+ constructor(props: {
230
+ matrix: Record<string, unknown>;
231
+ /** When set to true, GitHub cancels all in-progress jobs if any matrix job fails. Default: true */
232
+ "fail-fast"?: boolean;
233
+ /** The maximum number of jobs that can run simultaneously when using a matrix job strategy. By default, GitHub will maximize the number of jobs run in parallel depending on the available runners on GitHub-hosted virtual machines. */
234
+ "max-parallel"?: number;
235
+ });
236
+ }
237
+
238
+ export declare class Workflow {
239
+ constructor(props: {
240
+ /** A workflow run is made up of one or more jobs. Jobs run in parallel by default. To run jobs sequentially, you can define dependencies on other jobs using the jobs.<job_id>.needs keyword.
241
+ Each job runs in a fresh instance of the virtual environment specified by runs-on.
242
+ You can run an unlimited number of jobs as long as you are within the workflow usage limits. For more information, see https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#usage-limits. */
243
+ jobs: Record<string, unknown>;
244
+ /** The name of the GitHub event that triggers the workflow. You can provide a single event string, array of events, array of event types, or an event configuration map that schedules a workflow or restricts the execution of a workflow to specific files, tags, or branch changes. For a list of available events, see https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows. */
245
+ on: Record<string, unknown>;
246
+ /** Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the secrets context.
247
+ You can also specify concurrency at the workflow level.
248
+ When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled. To also cancel any currently running job or workflow in the same concurrency group, specify cancel-in-progress: true. */
249
+ concurrency?: Concurrency | string;
250
+ /** A map of default settings that will apply to all jobs in the workflow. */
251
+ defaults?: Defaults;
252
+ /** A map of environment variables that are available to all jobs and steps in the workflow. */
253
+ env?: Record<string, string>;
254
+ /** The name of your workflow. GitHub displays the names of your workflows on your repository's actions page. If you omit this field, GitHub sets the name to the workflow's filename. */
255
+ name?: string;
256
+ permissions?: Permissions | string;
257
+ /** The name for workflow runs generated from the workflow. GitHub displays the workflow run name in the list of workflow runs on your repository's 'Actions' tab. */
258
+ "run-name"?: string;
259
+ });
260
+ }
261
+
262
+ export declare class WorkflowCallTrigger {
263
+ constructor(props: {
264
+ inputs?: Record<string, unknown>;
265
+ outputs?: Record<string, unknown>;
266
+ secrets?: Record<string, unknown>;
267
+ });
268
+ }
269
+
270
+ export declare class WorkflowDispatchTrigger {
271
+ constructor(props: {
272
+ inputs?: Record<string, unknown>;
273
+ });
274
+ }
275
+
276
+ export declare class WorkflowInput {
277
+ constructor(props: {
278
+ default?: string;
279
+ description?: string;
280
+ options?: string[];
281
+ required?: boolean;
282
+ type?: "string" | "boolean" | "number" | "choice" | "environment";
283
+ });
284
+ }
285
+
286
+ export declare class WorkflowOutput {
287
+ constructor(props: {
288
+ value: string;
289
+ description?: string;
290
+ });
291
+ }
292
+
293
+ export declare class WorkflowRunTrigger {
294
+ constructor(props: {
295
+ branches?: string[];
296
+ "branches-ignore"?: string[];
297
+ types?: string[];
298
+ workflows?: string[];
299
+ });
300
+ }
301
+
302
+ export declare class WorkflowSecret {
303
+ constructor(props: {
304
+ description?: string;
305
+ required?: boolean;
306
+ });
307
+ }
308
+
309
+ // --- Expression type (inlined for portability) ---
310
+
311
+ export declare class Expression {
312
+ constructor(raw: string);
313
+ toString(): string;
314
+ valueOf(): string;
315
+ eq(value: string | Expression): Expression;
316
+ ne(value: string | Expression): Expression;
317
+ and(other: Expression): Expression;
318
+ or(other: Expression): Expression;
319
+ not(): Expression;
320
+ }
321
+
322
+ // --- GitHub Context Variables ---
323
+
324
+ export declare const GitHub: {
325
+ readonly Ref: Expression;
326
+ readonly RefName: Expression;
327
+ readonly RefType: Expression;
328
+ readonly Sha: Expression;
329
+ readonly Actor: Expression;
330
+ readonly TriggeringActor: Expression;
331
+ readonly Repository: Expression;
332
+ readonly RepositoryOwner: Expression;
333
+ readonly EventName: Expression;
334
+ readonly Event: Expression;
335
+ readonly RunId: Expression;
336
+ readonly RunNumber: Expression;
337
+ readonly RunAttempt: Expression;
338
+ readonly Workflow: Expression;
339
+ readonly WorkflowRef: Expression;
340
+ readonly Workspace: Expression;
341
+ readonly Token: Expression;
342
+ readonly Job: Expression;
343
+ readonly HeadRef: Expression;
344
+ readonly BaseRef: Expression;
345
+ readonly ServerUrl: Expression;
346
+ readonly ApiUrl: Expression;
347
+ readonly GraphqlUrl: Expression;
348
+ readonly Action: Expression;
349
+ readonly ActionPath: Expression;
350
+ };
351
+
352
+ export declare const Runner: {
353
+ readonly Os: Expression;
354
+ readonly Arch: Expression;
355
+ readonly Name: Expression;
356
+ readonly Temp: Expression;
357
+ readonly ToolCache: Expression;
358
+ };
@@ -0,0 +1,29 @@
1
+ // Code generated by chant generate. DO NOT EDIT.
2
+ import { createResource, createProperty } from "./runtime";
3
+
4
+ export const Job = createResource("GitHub::Actions::Job", "github", {});
5
+ export const ReusableWorkflowCallJob = createResource("GitHub::Actions::ReusableWorkflowCallJob", "github", {});
6
+ export const Workflow = createResource("GitHub::Actions::Workflow", "github", {});
7
+
8
+ export const Concurrency = createProperty("GitHub::Actions::Concurrency", "github");
9
+ export const Container = createProperty("GitHub::Actions::Container", "github");
10
+ export const Defaults = createProperty("GitHub::Actions::Defaults", "github");
11
+ export const Environment = createProperty("GitHub::Actions::Environment", "github");
12
+ export const Permissions = createProperty("GitHub::Actions::Permissions", "github");
13
+ export const PullRequestTargetTrigger = createProperty("GitHub::Actions::PullRequestTargetTrigger", "github");
14
+ export const PullRequestTrigger = createProperty("GitHub::Actions::PullRequestTrigger", "github");
15
+ export const PushTrigger = createProperty("GitHub::Actions::PushTrigger", "github");
16
+ export const RepositoryDispatchTrigger = createProperty("GitHub::Actions::RepositoryDispatchTrigger", "github");
17
+ export const ScheduleTrigger = createProperty("GitHub::Actions::ScheduleTrigger", "github");
18
+ export const Service = createProperty("GitHub::Actions::Service", "github");
19
+ export const Step = createProperty("GitHub::Actions::Step", "github");
20
+ export const Strategy = createProperty("GitHub::Actions::Strategy", "github");
21
+ export const WorkflowCallTrigger = createProperty("GitHub::Actions::WorkflowCallTrigger", "github");
22
+ export const WorkflowDispatchTrigger = createProperty("GitHub::Actions::WorkflowDispatchTrigger", "github");
23
+ export const WorkflowInput = createProperty("GitHub::Actions::WorkflowInput", "github");
24
+ export const WorkflowOutput = createProperty("GitHub::Actions::WorkflowOutput", "github");
25
+ export const WorkflowRunTrigger = createProperty("GitHub::Actions::WorkflowRunTrigger", "github");
26
+ export const WorkflowSecret = createProperty("GitHub::Actions::WorkflowSecret", "github");
27
+
28
+ // Re-exports for convenience
29
+ export { GitHub, Runner } from "../variables";
@@ -0,0 +1,135 @@
1
+ {
2
+ "Concurrency": {
3
+ "resourceType": "GitHub::Actions::Concurrency",
4
+ "kind": "property",
5
+ "lexicon": "github"
6
+ },
7
+ "Container": {
8
+ "resourceType": "GitHub::Actions::Container",
9
+ "kind": "property",
10
+ "lexicon": "github"
11
+ },
12
+ "Defaults": {
13
+ "resourceType": "GitHub::Actions::Defaults",
14
+ "kind": "property",
15
+ "lexicon": "github"
16
+ },
17
+ "Environment": {
18
+ "resourceType": "GitHub::Actions::Environment",
19
+ "kind": "property",
20
+ "lexicon": "github"
21
+ },
22
+ "Job": {
23
+ "resourceType": "GitHub::Actions::Job",
24
+ "kind": "resource",
25
+ "lexicon": "github",
26
+ "constraints": {
27
+ "timeout-minutes": {
28
+ "default": 360
29
+ }
30
+ }
31
+ },
32
+ "Permissions": {
33
+ "resourceType": "GitHub::Actions::Permissions",
34
+ "kind": "property",
35
+ "lexicon": "github",
36
+ "constraints": {
37
+ "models": {
38
+ "enum": [
39
+ "read",
40
+ "none"
41
+ ]
42
+ }
43
+ }
44
+ },
45
+ "PullRequestTargetTrigger": {
46
+ "resourceType": "GitHub::Actions::PullRequestTargetTrigger",
47
+ "kind": "property",
48
+ "lexicon": "github"
49
+ },
50
+ "PullRequestTrigger": {
51
+ "resourceType": "GitHub::Actions::PullRequestTrigger",
52
+ "kind": "property",
53
+ "lexicon": "github"
54
+ },
55
+ "PushTrigger": {
56
+ "resourceType": "GitHub::Actions::PushTrigger",
57
+ "kind": "property",
58
+ "lexicon": "github"
59
+ },
60
+ "RepositoryDispatchTrigger": {
61
+ "resourceType": "GitHub::Actions::RepositoryDispatchTrigger",
62
+ "kind": "property",
63
+ "lexicon": "github"
64
+ },
65
+ "ReusableWorkflowCallJob": {
66
+ "resourceType": "GitHub::Actions::ReusableWorkflowCallJob",
67
+ "kind": "resource",
68
+ "lexicon": "github",
69
+ "constraints": {
70
+ "uses": {
71
+ "pattern": "^(.+\\/)+(.+)\\.(ya?ml)(@.+)?$"
72
+ }
73
+ }
74
+ },
75
+ "ScheduleTrigger": {
76
+ "resourceType": "GitHub::Actions::ScheduleTrigger",
77
+ "kind": "property",
78
+ "lexicon": "github"
79
+ },
80
+ "Service": {
81
+ "resourceType": "GitHub::Actions::Service",
82
+ "kind": "property",
83
+ "lexicon": "github"
84
+ },
85
+ "Step": {
86
+ "resourceType": "GitHub::Actions::Step",
87
+ "kind": "property",
88
+ "lexicon": "github"
89
+ },
90
+ "Strategy": {
91
+ "resourceType": "GitHub::Actions::Strategy",
92
+ "kind": "property",
93
+ "lexicon": "github",
94
+ "constraints": {
95
+ "fail-fast": {
96
+ "default": true
97
+ }
98
+ }
99
+ },
100
+ "Workflow": {
101
+ "resourceType": "GitHub::Actions::Workflow",
102
+ "kind": "resource",
103
+ "lexicon": "github"
104
+ },
105
+ "WorkflowCallTrigger": {
106
+ "resourceType": "GitHub::Actions::WorkflowCallTrigger",
107
+ "kind": "property",
108
+ "lexicon": "github"
109
+ },
110
+ "WorkflowDispatchTrigger": {
111
+ "resourceType": "GitHub::Actions::WorkflowDispatchTrigger",
112
+ "kind": "property",
113
+ "lexicon": "github"
114
+ },
115
+ "WorkflowInput": {
116
+ "resourceType": "GitHub::Actions::WorkflowInput",
117
+ "kind": "property",
118
+ "lexicon": "github"
119
+ },
120
+ "WorkflowOutput": {
121
+ "resourceType": "GitHub::Actions::WorkflowOutput",
122
+ "kind": "property",
123
+ "lexicon": "github"
124
+ },
125
+ "WorkflowRunTrigger": {
126
+ "resourceType": "GitHub::Actions::WorkflowRunTrigger",
127
+ "kind": "property",
128
+ "lexicon": "github"
129
+ },
130
+ "WorkflowSecret": {
131
+ "resourceType": "GitHub::Actions::WorkflowSecret",
132
+ "kind": "property",
133
+ "lexicon": "github"
134
+ }
135
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Runtime factory constructors — re-exported from core.
3
+ */
4
+ export { createResource, createProperty } from "@intentius/chant/runtime";
@@ -0,0 +1,110 @@
1
+ import { describe, test, expect } from "bun:test";
2
+ import { GitHubActionsGenerator } from "./generator";
3
+ import type { TemplateIR } from "@intentius/chant/import/parser";
4
+
5
+ const generator = new GitHubActionsGenerator();
6
+
7
+ describe("GitHubActionsGenerator", () => {
8
+ test("generates import statement", () => {
9
+ const ir: TemplateIR = {
10
+ resources: [
11
+ {
12
+ logicalId: "workflow",
13
+ type: "GitHub::Actions::Workflow",
14
+ properties: { name: "CI" },
15
+ },
16
+ ],
17
+ parameters: [],
18
+ };
19
+ const files = generator.generate(ir);
20
+ expect(files).toHaveLength(1);
21
+ expect(files[0].content).toContain('import { Workflow } from "@intentius/chant-lexicon-github"');
22
+ });
23
+
24
+ test("generates workflow export", () => {
25
+ const ir: TemplateIR = {
26
+ resources: [
27
+ {
28
+ logicalId: "workflow",
29
+ type: "GitHub::Actions::Workflow",
30
+ properties: { name: "CI" },
31
+ },
32
+ ],
33
+ parameters: [],
34
+ };
35
+ const files = generator.generate(ir);
36
+ expect(files[0].content).toContain("export const workflow = new Workflow(");
37
+ expect(files[0].content).toContain('"name": "CI"');
38
+ });
39
+
40
+ test("generates job exports", () => {
41
+ const ir: TemplateIR = {
42
+ resources: [
43
+ {
44
+ logicalId: "build",
45
+ type: "GitHub::Actions::Job",
46
+ properties: { "runs-on": "ubuntu-latest" },
47
+ },
48
+ ],
49
+ parameters: [],
50
+ };
51
+ const files = generator.generate(ir);
52
+ expect(files[0].content).toContain("export const build = new Job(");
53
+ expect(files[0].content).toContain('"runs-on": "ubuntu-latest"');
54
+ });
55
+
56
+ test("imports multiple used constructors", () => {
57
+ const ir: TemplateIR = {
58
+ resources: [
59
+ {
60
+ logicalId: "workflow",
61
+ type: "GitHub::Actions::Workflow",
62
+ properties: { name: "CI" },
63
+ },
64
+ {
65
+ logicalId: "build",
66
+ type: "GitHub::Actions::Job",
67
+ properties: { "runs-on": "ubuntu-latest" },
68
+ },
69
+ ],
70
+ parameters: [],
71
+ };
72
+ const files = generator.generate(ir);
73
+ expect(files[0].content).toContain("Job");
74
+ expect(files[0].content).toContain("Workflow");
75
+ });
76
+
77
+ test("wraps nested property constructors", () => {
78
+ const ir: TemplateIR = {
79
+ resources: [
80
+ {
81
+ logicalId: "build",
82
+ type: "GitHub::Actions::Job",
83
+ properties: {
84
+ "runs-on": "ubuntu-latest",
85
+ strategy: { matrix: { "node-version": ["18", "20"] } },
86
+ },
87
+ },
88
+ ],
89
+ parameters: [],
90
+ };
91
+ const files = generator.generate(ir);
92
+ expect(files[0].content).toContain("new Strategy(");
93
+ expect(files[0].content).toContain("Strategy");
94
+ });
95
+
96
+ test("output file is named main.ts", () => {
97
+ const ir: TemplateIR = {
98
+ resources: [
99
+ {
100
+ logicalId: "workflow",
101
+ type: "GitHub::Actions::Workflow",
102
+ properties: { name: "CI" },
103
+ },
104
+ ],
105
+ parameters: [],
106
+ };
107
+ const files = generator.generate(ir);
108
+ expect(files[0].path).toBe("main.ts");
109
+ });
110
+ });