-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Expand file tree
/
Copy pathdisable-workflow.mjs
More file actions
47 lines (44 loc) · 1.2 KB
/
disable-workflow.mjs
File metadata and controls
47 lines (44 loc) · 1.2 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
import { ConfigurationError } from "@pipedream/platform";
import github from "../../github.app.mjs";
export default {
key: "github-disable-workflow",
name: "Disable Workflow",
description: "Disables a workflow and sets the **state** of the workflow to **disabled_manually**. [See the documentation](https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#disable-a-workflow)",
version: "0.0.7",
annotations: {
destructiveHint: true,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
github,
repoFullname: {
propDefinition: [
github,
"repoFullname",
],
},
workflowId: {
propDefinition: [
github,
"workflowId",
({ repoFullname }) => ({
repoFullname,
}),
],
},
},
async run({ $ }) {
try {
const response = await this.github.disableWorkflow({
repoFullname: this.repoFullname,
workflowId: this.workflowId,
});
$.export("$summary", `Successfully disabled the workflow with Id: ${this.workflowId}!`);
return response;
} catch (e) {
throw new ConfigurationError(e?.response?.data?.message);
}
},
};