Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across invocations with$checkpoint.
async (event, steps) => {
1
2
3
4
}
5
if(steps.trigger.event.action !=='labeled'){$end("Not a labeled issue. Exiting")}
if(steps.trigger.event.action !=='labeled'){$end("Not a labeled issue. Exiting")}
Select a reference from the object explorer below, enter a simple value (e.g., hello world),and/or enter an expression in {{...}} (e.g., {{event.foo}}).
string ·params.owner
Repo
1
Select a reference from the object explorer below, enter a simple value (e.g., hello world),and/or enter an expression in {{...}} (e.g., {{event.foo}}).
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across invocations with$checkpoint.
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across invocations with$checkpoint.
async (event, steps, auths) => {
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
}
121
const{ WebClient }=require('@slack/web-api')const web =newWebClient(auths.slack.oauth_access_token)const{ Octokit }=require("@octokit/rest");const octokit =newOctokit({
auth: auths.github.oauth_access_token,})const{ number: issue_number }= steps.trigger.event.issue
const opts ={...steps.CONSTANTS, issue_number }let numDays;let channel = process.env.DEV_REL_ENG_SLACK_SUPPORT_CHANNELswitch(steps.trigger.event.label.name){case'actions-docs':await octokit.rest.issues.createComment({...opts,
body:`Thanks for the request! Did you know that anyone can [author and publish their own Pipedream actions](https://pipedream.com/docs/components/quickstart/nodejs/actions/)? Would you be interested in helping out with that? We're happy to answer any questions or support you in any way.
If you don't have the time, would you be willing to reach out to the app provider to see if they're interested in building these? When we work with an app partner, it improves the quality of the integration, and it helps when this kind of request comes from a customer like you.`,});await octokit.rest.issues.addLabels({...opts,
labels:["requested user help with component"]})break;case'source-docs':await octokit.rest.issues.createComment({...opts,
body:`Thanks for the request! Did you know that anyone can [author and publish their own Pipedream sources](https://pipedream.com/docs/components/quickstart/nodejs/sources/)? Would you be interested in helping out with that? We're happy to answer any questions or support you in any way.
If you don't have the time, would you be willing to reach out to the app provider to see if they're interested in building these? When we work with an app partner, it improves the quality of the integration, and it helps when this kind of request comes from a customer like you.`,});await octokit.rest.issues.addLabels({...opts,
labels:["requested user help with component"]})break;case'actions-and-sources-docs':await octokit.rest.issues.createComment({...opts,
body:`Thanks for the request! Did you know that anyone can [author and publish their own Pipedream actions](https://pipedream.com/docs/components/quickstart/nodejs/actions/) and [sources](https://pipedream.com/docs/components/quickstart/nodejs/sources/)? Would you be interested in helping out with that? We're happy to answer any questions or support you in any way.
If you don't have the time, would you be willing to reach out to the app provider to see if they're interested in building these? When we work with an app partner, it improves the quality of the integration, and it helps when this kind of request comes from a customer like you.`,});await octokit.rest.issues.addLabels({...opts,
labels:["requested user help with component"]})break;case'app':await web.chat.postMessage({
text:`New app request: <${steps.trigger.event.issue.html_url}|${steps.trigger.event.issue.title}>`,
channel:"#app-submissions",})break;case'remind-me-in-30':case'remind-me-in-90':const splitLabel = steps.trigger.event.label.name.split('-')// e.g. remind-me-in-30 -> 30const numDays = splitLabel[splitLabel.length -1]await web.chat.postMessage({
text:`I'll remind you to check <${steps.trigger.event.issue.html_url}|${steps.trigger.event.issue.title}> in ${numDays} days`,
channel,})await web.chat.scheduleMessage({
text:`This is your ${numDays} day reminder to check on <${steps.trigger.event.issue.html_url}|${steps.trigger.event.issue.title}>`,
channel,
post_at: Math.floor(+newDate()/1000)+(60*60*24* numDays)})break;case'triaged':// const channelId = process.env.DEV_REL_ENG_SLACK_SUPPORT_CHANNEL_ID// // Lookup the info for the issue in DDB// const { accessKeyId, secretAccessKey } = auths.aws// const AWS = require("aws-sdk")// const dynamodb = new AWS.DynamoDB.DocumentClient({// accessKeyId,// secretAccessKey,// region: "us-east-1",// });// const { Item } = await dynamodb.get({// TableName: process.env.DEV_REL_ENG_BACKLOG_GH_ISSUE_TO_CARD_MAPPING_TABLE,// Key: {// issueId: steps.trigger.event.issue.id,// }// }).promise();// const { cardId: card_id, slackThreadId } = Item// if (!card_id || !slackThreadId) {// break;// }// // Moves card to the Done column of the project board// await octokit.rest.projects.moveCard({// card_id,// column_id: parseInt(process.env.DEV_REL_ENG_DONE_COLUMN_ID),// position: 'top',// });// await web.reactions.add({// channel: channelId,// name: "white_check_mark",// timestamp: slackThreadId,// })// await web.chat.postMessage({// text: `Issue triaged, not a support issue. Moving to done.`,// channel,// thread_ts: slackThreadId// })// break;default:break;}
const{ WebClient }=require('@slack/web-api')const web =newWebClient(auths.slack.oauth_access_token)const{ Octokit }=require("@octokit/rest");const octokit =newOctokit({
auth: auths.github.oauth_access_token,})const{ number: issue_number }= steps.trigger.event.issue
const opts ={...steps.CONSTANTS, issue_number }let numDays;let channel = process.env.DEV_REL_ENG_SLACK_SUPPORT_CHANNELswitch(steps.trigger.event.label.name){case'actions-docs':await octokit.rest.issues.createComment({...opts,
body:`Thanks for the request! Did you know that anyone can [author and publish their own Pipedream actions](https://pipedream.com/docs/components/quickstart/nodejs/actions/)? Would you be interested in helping out with that? We're happy to answer any questions or support you in any way.
If you don't have the time, would you be willing to reach out to the app provider to see if they're interested in building these? When we work with an app partner, it improves the quality of the integration, and it helps when this kind of request comes from a customer like you.`,});await octokit.rest.issues.addLabels({...opts,
labels:["requested user help with component"]})break;case'source-docs':await octokit.rest.issues.createComment({...opts,
body:`Thanks for the request! Did you know that anyone can [author and publish their own Pipedream sources](https://pipedream.com/docs/components/quickstart/nodejs/sources/)? Would you be interested in helping out with that? We're happy to answer any questions or support you in any way.
If you don't have the time, would you be willing to reach out to the app provider to see if they're interested in building these? When we work with an app partner, it improves the quality of the integration, and it helps when this kind of request comes from a customer like you.`,});await octokit.rest.issues.addLabels({...opts,
labels:["requested user help with component"]})break;case'actions-and-sources-docs':await octokit.rest.issues.createComment({...opts,
body:`Thanks for the request! Did you know that anyone can [author and publish their own Pipedream actions](https://pipedream.com/docs/components/quickstart/nodejs/actions/) and [sources](https://pipedream.com/docs/components/quickstart/nodejs/sources/)? Would you be interested in helping out with that? We're happy to answer any questions or support you in any way.
If you don't have the time, would you be willing to reach out to the app provider to see if they're interested in building these? When we work with an app partner, it improves the quality of the integration, and it helps when this kind of request comes from a customer like you.`,});await octokit.rest.issues.addLabels({...opts,
labels:["requested user help with component"]})break;case'app':await web.chat.postMessage({
text:`New app request: <${steps.trigger.event.issue.html_url}|${steps.trigger.event.issue.title}>`,
channel:"#app-submissions",})break;case'remind-me-in-30':case'remind-me-in-90':const splitLabel = steps.trigger.event.label.name.split('-')// e.g. remind-me-in-30 -> 30const numDays = splitLabel[splitLabel.length -1]await web.chat.postMessage({
text:`I'll remind you to check <${steps.trigger.event.issue.html_url}|${steps.trigger.event.issue.title}> in ${numDays} days`,
channel,})await web.chat.scheduleMessage({
text:`This is your ${numDays} day reminder to check on <${steps.trigger.event.issue.html_url}|${steps.trigger.event.issue.title}>`,
channel,
post_at: Math.floor(+newDate()/1000)+(60*60*24* numDays)})break;case'triaged':// const channelId = process.env.DEV_REL_ENG_SLACK_SUPPORT_CHANNEL_ID// // Lookup the info for the issue in DDB// const { accessKeyId, secretAccessKey } = auths.aws// const AWS = require("aws-sdk")// const dynamodb = new AWS.DynamoDB.DocumentClient({// accessKeyId,// secretAccessKey,// region: "us-east-1",// });// const { Item } = await dynamodb.get({// TableName: process.env.DEV_REL_ENG_BACKLOG_GH_ISSUE_TO_CARD_MAPPING_TABLE,// Key: {// issueId: steps.trigger.event.issue.id,// }// }).promise();// const { cardId: card_id, slackThreadId } = Item// if (!card_id || !slackThreadId) {// break;// }// // Moves card to the Done column of the project board// await octokit.rest.projects.moveCard({// card_id,// column_id: parseInt(process.env.DEV_REL_ENG_DONE_COLUMN_ID),// position: 'top',// });// await web.reactions.add({// channel: channelId,// name: "white_check_mark",// timestamp: slackThreadId,// })// await web.chat.postMessage({// text: `Issue triaged, not a support issue. Moving to done.`,// channel,// thread_ts: slackThreadId// })// break;default:break;}
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across invocations with$checkpoint.