-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Expand file tree
/
Copy pathcreate-workflow-dispatch.mjs
More file actions
62 lines (59 loc) · 1.69 KB
/
create-workflow-dispatch.mjs
File metadata and controls
62 lines (59 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { ConfigurationError } from "@pipedream/platform";
import github from "../../github.app.mjs";
export default {
key: "github-create-workflow-dispatch",
name: "Create Workflow Dispatch",
description: "Creates a new workflow dispatch event. [See the documentation](https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event)",
version: "0.0.7",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
github,
repoFullname: {
propDefinition: [
github,
"repoFullname",
],
},
workflowId: {
propDefinition: [
github,
"workflowId",
({ repoFullname }) => ({
repoFullname,
}),
],
},
ref: {
type: "string",
label: "Ref",
description: "The git reference for the workflow. The reference can be a branch or tag name.",
},
inputs: {
type: "object",
label: "Inputs",
description: "Input keys and values configured in the workflow file. The maximum number of properties is 10. Any default properties configured in the workflow file will be used when inputs are omitted.",
optional: true,
},
},
async run({ $ }) {
try {
const response = await this.github.createWorkflowDispatch({
repoFullname: this.repoFullname,
workflowId: this.workflowId,
data: {
ref: this.ref,
inputs: this.inputs,
},
});
$.export("$summary", "Workflow dispatch successfully created!");
return response;
} catch (e) {
throw new ConfigurationError(e?.response?.data?.message);
}
},
};