gagen 0.3.1 → 0.3.3
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.
- package/README.md +40 -103
- package/esm/job.d.ts +5 -1
- package/esm/job.d.ts.map +1 -1
- package/esm/job.js +19 -3
- package/esm/mod.d.ts +1 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/workflow.d.ts +3 -0
- package/esm/workflow.d.ts.map +1 -1
- package/esm/workflow.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ initial code is more easily maintainable.
|
|
|
16
16
|
## Basic usage
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
|
-
#!/usr/bin/env -S deno run --allow-read=ci.yml --allow-write=ci.yml
|
|
19
|
+
#!/usr/bin/env -S deno run --allow-read=ci.generated.yml --allow-write=ci.generated.yml
|
|
20
20
|
import { conditions, createWorkflow, step } from "gagen";
|
|
21
21
|
|
|
22
22
|
const checkout = step({
|
|
@@ -56,17 +56,17 @@ createWorkflow({
|
|
|
56
56
|
steps: [lint, test],
|
|
57
57
|
}],
|
|
58
58
|
}).writeOrLint({
|
|
59
|
-
filePath: new URL("./ci.yml", import.meta.url),
|
|
60
|
-
header: "# GENERATED BY ./ci.
|
|
59
|
+
filePath: new URL("./ci.generated.yml", import.meta.url),
|
|
60
|
+
header: "# GENERATED BY ./ci.ts -- DO NOT DIRECTLY EDIT",
|
|
61
61
|
});
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
This generates a `ci.yml` with steps in the correct order and figures
|
|
65
|
-
it should only install deno when the lint step should be run and it
|
|
66
|
-
step only until it's necessary.
|
|
64
|
+
This generates a `ci.generated.yml` with steps in the correct order and figures
|
|
65
|
+
out that it should only install deno when the lint step should be run and it
|
|
66
|
+
defers that step only until it's necessary.
|
|
67
67
|
|
|
68
68
|
```yaml
|
|
69
|
-
# GENERATED BY ./ci.
|
|
69
|
+
# GENERATED BY ./ci.ts -- DO NOT DIRECTLY EDIT
|
|
70
70
|
|
|
71
71
|
name: ci
|
|
72
72
|
on:
|
|
@@ -92,15 +92,15 @@ jobs:
|
|
|
92
92
|
# gagen:pin denoland/setup-deno@v2 = 667a34cdef165d8d2b2e98dde39547c9daac7282
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
When run normally, this writes `ci.yml`. When run with `--lint`, it
|
|
96
|
-
existing file and compares the parsed YAML — exiting with a non-zero
|
|
97
|
-
they differ. This lets you add a CI step to verify the generated file is
|
|
98
|
-
date:
|
|
95
|
+
When run normally, this writes `ci.generated.yml`. When run with `--lint`, it
|
|
96
|
+
reads the existing file and compares the parsed YAML — exiting with a non-zero
|
|
97
|
+
code if they differ. This lets you add a CI step to verify the generated file is
|
|
98
|
+
up to date:
|
|
99
99
|
|
|
100
100
|
```ts
|
|
101
101
|
const lintStep = step({
|
|
102
102
|
name: "Lint CI generation",
|
|
103
|
-
run: "./.github/workflows/ci.
|
|
103
|
+
run: "./.github/workflows/ci.ts --lint",
|
|
104
104
|
});
|
|
105
105
|
```
|
|
106
106
|
|
|
@@ -133,7 +133,7 @@ dependencies.
|
|
|
133
133
|
To force re-resolving all pins, run with the `--update-pins` flag:
|
|
134
134
|
|
|
135
135
|
```sh
|
|
136
|
-
./ci.
|
|
136
|
+
./ci.ts --update-pins
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
Pinning can be disabled by setting `pinDeps` to `false`:
|
|
@@ -238,7 +238,7 @@ const runner = os.equals("linux").then("ubuntu-latest")
|
|
|
238
238
|
|
|
239
239
|
// use in job config
|
|
240
240
|
createWorkflow({
|
|
241
|
-
...,
|
|
241
|
+
// ...,
|
|
242
242
|
jobs: [
|
|
243
243
|
{ id: "build", runsOn: runner, steps: [test] },
|
|
244
244
|
],
|
|
@@ -291,25 +291,6 @@ createWorkflow({
|
|
|
291
291
|
// checkout gets: if: matrix.job == 'test' || matrix.job == 'bench'
|
|
292
292
|
```
|
|
293
293
|
|
|
294
|
-
To prevent propagation, pass the unconditional steps to `steps` as well. Leaf
|
|
295
|
-
steps act as propagation barriers:
|
|
296
|
-
|
|
297
|
-
```ts
|
|
298
|
-
const build = step.dependsOn(checkout)({ run: "cargo build" });
|
|
299
|
-
const test = step.dependsOn(build)({ run: "cargo test" });
|
|
300
|
-
const linuxOnly = step.dependsOn(build, test).if(os.equals("linux"))({
|
|
301
|
-
run: "linux-specific",
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
// test is a leaf with no condition — blocks propagation to build and checkout
|
|
305
|
-
createWorkflow({
|
|
306
|
-
...,
|
|
307
|
-
jobs: [
|
|
308
|
-
{ id: "test", runsOn: "ubuntu-latest", steps: [test, linuxOnly] },
|
|
309
|
-
],
|
|
310
|
-
});
|
|
311
|
-
```
|
|
312
|
-
|
|
313
294
|
## Step outputs and job dependencies
|
|
314
295
|
|
|
315
296
|
Steps can declare outputs. When a job references another job's outputs, the
|
|
@@ -411,17 +392,16 @@ Error: Cycle detected in step ordering: A → B → A
|
|
|
411
392
|
`defineMatrix()` gives you typed access to matrix values:
|
|
412
393
|
|
|
413
394
|
```ts
|
|
414
|
-
import { defineMatrix } from "gagen";
|
|
395
|
+
import { createWorkflow, defineMatrix } from "gagen";
|
|
415
396
|
|
|
416
397
|
const matrix = defineMatrix({
|
|
417
398
|
include: [
|
|
418
|
-
{
|
|
419
|
-
{
|
|
399
|
+
{ runner: "ubuntu-latest" },
|
|
400
|
+
{ runner: "macos-latest" },
|
|
420
401
|
],
|
|
421
402
|
});
|
|
422
403
|
|
|
423
|
-
matrix.
|
|
424
|
-
matrix.runner; // ExpressionValue("matrix.runner")
|
|
404
|
+
matrix.runner; // ExpressionValue("matrix.runner") — autocompletes
|
|
425
405
|
matrix.foo; // TypeScript error — not a matrix key
|
|
426
406
|
|
|
427
407
|
createWorkflow({
|
|
@@ -499,57 +479,6 @@ createWorkflow({
|
|
|
499
479
|
Permission scopes (`contents`, `packages`, `id-token`, etc.) and levels (`read`,
|
|
500
480
|
`write`, `none`) are fully typed.
|
|
501
481
|
|
|
502
|
-
## Reusable workflows
|
|
503
|
-
|
|
504
|
-
Define reusable workflows with `workflow_call` triggers and call them from other
|
|
505
|
-
jobs:
|
|
506
|
-
|
|
507
|
-
```ts
|
|
508
|
-
import { createWorkflow } from "gagen";
|
|
509
|
-
|
|
510
|
-
// define a reusable workflow
|
|
511
|
-
const wf = createWorkflow({
|
|
512
|
-
name: "Reusable Build",
|
|
513
|
-
on: {
|
|
514
|
-
workflow_call: {
|
|
515
|
-
inputs: {
|
|
516
|
-
environment: { type: "string", required: true },
|
|
517
|
-
debug: { type: "boolean", default: false },
|
|
518
|
-
},
|
|
519
|
-
outputs: {
|
|
520
|
-
build_id: {
|
|
521
|
-
description: "The build ID",
|
|
522
|
-
value: "${{ jobs.build.outputs.id }}",
|
|
523
|
-
},
|
|
524
|
-
},
|
|
525
|
-
secrets: {
|
|
526
|
-
deploy_key: { required: true },
|
|
527
|
-
},
|
|
528
|
-
},
|
|
529
|
-
},
|
|
530
|
-
});
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
Call a reusable workflow from a job using `uses` instead of `runsOn`:
|
|
534
|
-
|
|
535
|
-
```ts
|
|
536
|
-
const wf = createWorkflow({
|
|
537
|
-
name: "CI",
|
|
538
|
-
on: ["push", "pull_request"],
|
|
539
|
-
jobs: [
|
|
540
|
-
{
|
|
541
|
-
id: "build",
|
|
542
|
-
uses: "octo-org/example/.github/workflows/build.yml@main",
|
|
543
|
-
with: { environment: "production" },
|
|
544
|
-
secrets: "inherit",
|
|
545
|
-
},
|
|
546
|
-
],
|
|
547
|
-
});
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
Reusable jobs support `with`, `secrets` (either `"inherit"` or a record), and
|
|
551
|
-
all common job fields (`name`, `needs`, `if`, `permissions`, `concurrency`).
|
|
552
|
-
|
|
553
482
|
## Artifacts
|
|
554
483
|
|
|
555
484
|
Link upload and download artifact steps across jobs with automatic `needs`
|
|
@@ -564,22 +493,30 @@ import {
|
|
|
564
493
|
|
|
565
494
|
const artifact = defineArtifact("build-output");
|
|
566
495
|
|
|
567
|
-
const buildStep = step({ name: "Build", run: "make build" });
|
|
568
|
-
const upload = artifact.upload({ path: "dist/" });
|
|
569
|
-
|
|
570
|
-
const download = artifact.download({ dirPath: "output/" });
|
|
571
|
-
const deployStep = step.dependsOn(download)({
|
|
572
|
-
name: "Deploy",
|
|
573
|
-
run: "make deploy",
|
|
574
|
-
});
|
|
575
|
-
|
|
576
496
|
const wf = createWorkflow({
|
|
577
497
|
name: "CI",
|
|
578
498
|
on: ["push", "pull_request"],
|
|
579
499
|
jobs: [
|
|
580
|
-
{
|
|
581
|
-
|
|
582
|
-
|
|
500
|
+
{
|
|
501
|
+
id: "build",
|
|
502
|
+
runsOn: "ubuntu-latest",
|
|
503
|
+
steps: [
|
|
504
|
+
step({ name: "Build", run: "make build" }),
|
|
505
|
+
artifact.upload({ path: "dist/" }),
|
|
506
|
+
],
|
|
507
|
+
},
|
|
508
|
+
// `needs: [build]` is inferred automatically from the artifact link
|
|
509
|
+
{
|
|
510
|
+
id: "deploy",
|
|
511
|
+
runsOn: "ubuntu-latest",
|
|
512
|
+
steps: [
|
|
513
|
+
artifact.download({ dirPath: "output/" }),
|
|
514
|
+
step({
|
|
515
|
+
name: "Deploy",
|
|
516
|
+
run: "make deploy",
|
|
517
|
+
}),
|
|
518
|
+
],
|
|
519
|
+
},
|
|
583
520
|
],
|
|
584
521
|
});
|
|
585
522
|
```
|
|
@@ -601,8 +538,8 @@ const artifact = defineArtifact("build-output", {
|
|
|
601
538
|
```ts
|
|
602
539
|
const matrix = defineMatrix({
|
|
603
540
|
include: [
|
|
604
|
-
{
|
|
605
|
-
{
|
|
541
|
+
{ runner: "ubuntu-latest" },
|
|
542
|
+
{ runner: "macos-latest" },
|
|
606
543
|
],
|
|
607
544
|
});
|
|
608
545
|
|
package/esm/job.d.ts
CHANGED
|
@@ -23,8 +23,12 @@ export interface ServiceContainer {
|
|
|
23
23
|
volumes?: string[];
|
|
24
24
|
options?: string;
|
|
25
25
|
}
|
|
26
|
+
export type RunsOn = string | ExpressionValue | readonly string[] | {
|
|
27
|
+
group?: string;
|
|
28
|
+
labels?: string | readonly string[];
|
|
29
|
+
};
|
|
26
30
|
export interface StepsJobConfig extends CommonJobFields {
|
|
27
|
-
runsOn:
|
|
31
|
+
runsOn: RunsOn;
|
|
28
32
|
strategy?: {
|
|
29
33
|
matrix?: unknown;
|
|
30
34
|
failFast?: boolean | ConditionLike;
|
package/esm/job.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,eAAe,EAGhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAGhB,IAAI,EACJ,KAAK,QAAQ,EAId,MAAM,WAAW,CAAC;AAEnB,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IAChC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,EAAE,CAAC,EAAE,aAAa,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,CAAC;IACrE,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAC;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,C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
|
|
355
355
|
}
|
|
356
356
|
// steps-based job
|
|
357
|
-
result["runs-on"] = config.runsOn
|
|
358
|
-
? config.runsOn.toString()
|
|
359
|
-
: config.runsOn;
|
|
357
|
+
result["runs-on"] = serializeRunsOn(config.runsOn);
|
|
360
358
|
if (config.container != null) {
|
|
361
359
|
result.container = typeof config.container === "string"
|
|
362
360
|
? config.container
|
|
@@ -951,6 +949,24 @@ function collectJobSourcesFromGraph(graph, out, stepOwners) {
|
|
|
951
949
|
}
|
|
952
950
|
}
|
|
953
951
|
}
|
|
952
|
+
function serializeRunsOn(runsOn) {
|
|
953
|
+
if (runsOn instanceof ExpressionValue) {
|
|
954
|
+
return runsOn.toString();
|
|
955
|
+
}
|
|
956
|
+
if (Array.isArray(runsOn)) {
|
|
957
|
+
return [...runsOn];
|
|
958
|
+
}
|
|
959
|
+
if (typeof runsOn === "object") {
|
|
960
|
+
const obj = runsOn;
|
|
961
|
+
const result = {};
|
|
962
|
+
if (obj.group != null)
|
|
963
|
+
result.group = obj.group;
|
|
964
|
+
if (obj.labels != null)
|
|
965
|
+
result.labels = obj.labels;
|
|
966
|
+
return result;
|
|
967
|
+
}
|
|
968
|
+
return runsOn;
|
|
969
|
+
}
|
|
954
970
|
function serializeService(svc) {
|
|
955
971
|
const result = { image: svc.image };
|
|
956
972
|
if (svc.credentials != null) {
|
package/esm/mod.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import "./_dnt.polyfills.js";
|
|
|
2
2
|
export { Step, step, StepRef } from "./step.js";
|
|
3
3
|
export type { ConditionLike, ConfigValue, StepBuilder, StepConfig, StepFunction, StepLike, } from "./step.js";
|
|
4
4
|
export { Job, job } from "./job.js";
|
|
5
|
-
export type { JobConfig, JobDef, ReusableJobConfig, ReusableJobDef, ServiceContainer, StepsJobConfig, StepsJobDef, } from "./job.js";
|
|
5
|
+
export type { JobConfig, JobDef, ReusableJobConfig, ReusableJobDef, RunsOn, ServiceContainer, StepsJobConfig, StepsJobDef, } from "./job.js";
|
|
6
6
|
export { createWorkflow, isLinting, Workflow } from "./workflow.js";
|
|
7
7
|
export type { WorkflowCallInput, WorkflowCallOutput, WorkflowCallSecret, WorkflowCallTrigger, WorkflowConfig, WorkflowTriggers, } from "./workflow.js";
|
|
8
8
|
export { concat, Condition, conditions, defineExprObj, ElseIfBuilder, expr, ExpressionValue, fromJSON, hashFiles, join, literal, ThenBuilder, toJSON, } from "./expression.js";
|
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,YAAY,EACV,SAAS,EACT,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,MAAM,EACN,SAAS,EACT,UAAU,EACV,aAAa,EACb,aAAa,EACb,IAAI,EACJ,eAAe,EACf,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,OAAO,EACP,WAAW,EACX,MAAM,GACP,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,YAAY,GACb,MAAM,iBA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AAW,EACX,MAAM,GACP,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,eAAe,GAChB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EACV,eAAe,EACf,WAAW,EACX,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,YAAY,EACV,eAAe,EACf,cAAc,EACd,YAAY,GACb,MAAM,eAAe,CAAC"}
|
package/esm/workflow.d.ts
CHANGED
|
@@ -24,12 +24,15 @@ export interface WorkflowCallTrigger {
|
|
|
24
24
|
export interface WorkflowTriggers {
|
|
25
25
|
push?: {
|
|
26
26
|
branches?: string[];
|
|
27
|
+
branchesIgnore?: string[];
|
|
27
28
|
tags?: string[];
|
|
29
|
+
tagsIgnore?: string[];
|
|
28
30
|
paths?: string[];
|
|
29
31
|
pathsIgnore?: string[];
|
|
30
32
|
};
|
|
31
33
|
pull_request?: {
|
|
32
34
|
branches?: string[];
|
|
35
|
+
branchesIgnore?: string[];
|
|
33
36
|
types?: string[];
|
|
34
37
|
paths?: string[];
|
|
35
38
|
pathsIgnore?: string[];
|
package/esm/workflow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAgB,KAAK,MAAM,EAAgB,MAAM,UAAU,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAk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AM,CAAA;SAAE,CAAA;KAAE,CAAC;IACnE,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,CAAC;CACzB;AAED,qBAAa,QAAQ;;gBAIP,MAAM,EAAE,cAAc;IAqBlC,YAAY,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAgFnD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAIpE,WAAW,CACT,OAAO,EAAE;QACP,QAAQ,EAAE,GAAG,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,GAAG;YAAE,OAAO,EAAE,WAAW,CAAA;SAAE,CAAC;KAC9C,GACA,IAAI;CAmDR;AAED,0EAA0E;AAC1E,eAAO,MAAM,SAAS,EAAE,OAAyC,CAAC;AAElE,iFAAiF;AACjF,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ,CAE/D"}
|
package/esm/workflow.js
CHANGED
|
@@ -176,10 +176,7 @@ function serializeTriggers(triggers) {
|
|
|
176
176
|
for (const [key, value] of Object.entries(triggers)) {
|
|
177
177
|
if (value == null)
|
|
178
178
|
continue;
|
|
179
|
-
if (
|
|
180
|
-
result["paths-ignore"] = value;
|
|
181
|
-
}
|
|
182
|
-
else if (typeof value === "object" && !Array.isArray(value)) {
|
|
179
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
183
180
|
result[key] = serializeTriggerObject(value);
|
|
184
181
|
}
|
|
185
182
|
else {
|
|
@@ -188,12 +185,15 @@ function serializeTriggers(triggers) {
|
|
|
188
185
|
}
|
|
189
186
|
return result;
|
|
190
187
|
}
|
|
188
|
+
function camelToKebab(key) {
|
|
189
|
+
return key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
190
|
+
}
|
|
191
191
|
function serializeTriggerObject(obj) {
|
|
192
192
|
const result = {};
|
|
193
193
|
for (const [key, value] of Object.entries(obj)) {
|
|
194
194
|
if (value == null)
|
|
195
195
|
continue;
|
|
196
|
-
const yamlKey = key
|
|
196
|
+
const yamlKey = camelToKebab(key);
|
|
197
197
|
result[yamlKey] = value;
|
|
198
198
|
}
|
|
199
199
|
return result;
|