@factorialco/gat 0.0.7 → 0.0.8
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/dist/event.d.ts +11 -2
- package/dist/workflow.spec.js +21 -0
- package/package.json +1 -1
package/dist/event.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare type EventName = "push" | "pull_request" | "pull_request_review" | "workflow_run";
|
|
2
|
-
export declare type EventOptions<T extends EventName> = T extends "push" ? PushEventOptions : T extends "pull_request" ? PullRequestEventOptions : T extends "pull_request_review" ? PullRequestReviewEventOptions : T extends "workflow_run" ? WorkflowRunEventOptions : never;
|
|
1
|
+
export declare type EventName = "push" | "pull_request" | "pull_request_review" | "workflow_run" | "workflow_dispatch";
|
|
2
|
+
export declare type EventOptions<T extends EventName> = T extends "push" ? PushEventOptions : T extends "pull_request" ? PullRequestEventOptions : T extends "pull_request_review" ? PullRequestReviewEventOptions : T extends "workflow_run" ? WorkflowRunEventOptions : T extends "workflow_dispatch" ? WorkflowDispatchEventOptions : never;
|
|
3
3
|
interface PushEventOptions {
|
|
4
4
|
branches?: string[];
|
|
5
5
|
paths?: string[];
|
|
@@ -15,6 +15,15 @@ interface WorkflowRunEventOptions {
|
|
|
15
15
|
workflows?: string[];
|
|
16
16
|
types?: Array<"completed">;
|
|
17
17
|
}
|
|
18
|
+
interface WorkflowDispatchInput {
|
|
19
|
+
description: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
type?: "choice" | "boolean";
|
|
22
|
+
options?: string[];
|
|
23
|
+
}
|
|
24
|
+
interface WorkflowDispatchEventOptions {
|
|
25
|
+
inputs?: Record<string, WorkflowDispatchInput>;
|
|
26
|
+
}
|
|
18
27
|
export interface Event {
|
|
19
28
|
name: EventName;
|
|
20
29
|
options?: EventOptions<EventName>;
|
package/dist/workflow.spec.js
CHANGED
|
@@ -162,4 +162,25 @@ const workflow_1 = require("./workflow");
|
|
|
162
162
|
});
|
|
163
163
|
(0, vitest_1.expect)(workflow.compile()).toMatchSnapshot();
|
|
164
164
|
});
|
|
165
|
+
(0, vitest_1.it)("support workflow dispatch event", () => {
|
|
166
|
+
const workflow = new workflow_1.Workflow("Workflow dispatch");
|
|
167
|
+
workflow
|
|
168
|
+
.on("workflow_dispatch", {
|
|
169
|
+
inputs: {
|
|
170
|
+
foo: {
|
|
171
|
+
description: "A foo input",
|
|
172
|
+
required: true,
|
|
173
|
+
},
|
|
174
|
+
bar: {
|
|
175
|
+
description: "A bar input",
|
|
176
|
+
type: "choice",
|
|
177
|
+
options: ["bar", "baz"],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
})
|
|
181
|
+
.addJob("job1", {
|
|
182
|
+
steps: [{ name: "Do something", run: "exit 0" }],
|
|
183
|
+
});
|
|
184
|
+
(0, vitest_1.expect)(workflow.compile()).toMatchSnapshot();
|
|
185
|
+
});
|
|
165
186
|
});
|