@factorialco/gat 0.0.6 → 0.0.9
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 +19 -3
- package/dist/step.d.ts +1 -0
- package/dist/workflow.js +2 -1
- package/dist/workflow.spec.js +21 -0
- package/package.json +1 -1
package/dist/event.d.ts
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
export declare type EventName = "push" | "pull_request";
|
|
2
|
-
export declare type EventOptions<T extends EventName> = T extends "push" ? PushEventOptions : T extends "pull_request" ? PullRequestEventOptions : 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[];
|
|
6
6
|
}
|
|
7
7
|
interface PullRequestEventOptions {
|
|
8
|
-
types?: Array<"opened" | "reopened" | "synchronize">;
|
|
8
|
+
types?: Array<"opened" | "reopened" | "synchronize" | "labeled" | "unlabeled">;
|
|
9
9
|
paths?: string[];
|
|
10
10
|
}
|
|
11
|
+
interface PullRequestReviewEventOptions {
|
|
12
|
+
types?: Array<"submitted">;
|
|
13
|
+
}
|
|
14
|
+
interface WorkflowRunEventOptions {
|
|
15
|
+
workflows?: string[];
|
|
16
|
+
types?: Array<"completed">;
|
|
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
|
+
}
|
|
11
27
|
export interface Event {
|
|
12
28
|
name: EventName;
|
|
13
29
|
options?: EventOptions<EventName>;
|
package/dist/step.d.ts
CHANGED
package/dist/workflow.js
CHANGED
|
@@ -77,10 +77,11 @@ class Workflow {
|
|
|
77
77
|
}
|
|
78
78
|
: undefined,
|
|
79
79
|
env,
|
|
80
|
-
steps: steps.map(({ id, name, ifExpression, workingDirectory, ...options }) => ({
|
|
80
|
+
steps: steps.map(({ id, name, ifExpression, workingDirectory, continueOnError, ...options }) => ({
|
|
81
81
|
id,
|
|
82
82
|
name,
|
|
83
83
|
if: ifExpression,
|
|
84
|
+
"continue-on-error": continueOnError,
|
|
84
85
|
"working-directory": workingDirectory,
|
|
85
86
|
...options,
|
|
86
87
|
})),
|
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
|
});
|