-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathissue_closed.ts
More file actions
329 lines (325 loc) · 8.33 KB
/
issue_closed.ts
File metadata and controls
329 lines (325 loc) · 8.33 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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
import { GithubIcon } from '@/components/icons'
import type { TriggerConfig } from '@/triggers/types'
export const githubIssueClosedTrigger: TriggerConfig = {
id: 'github_issue_closed',
name: 'GitHub Issue Closed',
provider: 'github',
description: 'Trigger workflow when an issue is closed in a GitHub repository',
version: '1.0.0',
icon: GithubIcon,
subBlocks: [
{
id: 'webhookUrlDisplay',
title: 'Webhook URL',
type: 'short-input',
readOnly: true,
showCopyButton: true,
useWebhookUrl: true,
placeholder: 'Webhook URL will be generated',
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'github_issue_closed',
},
},
{
id: 'contentType',
title: 'Content Type',
type: 'dropdown',
options: [
{ label: 'application/json', id: 'application/json' },
{
label: 'application/x-www-form-urlencoded',
id: 'application/x-www-form-urlencoded',
},
],
defaultValue: 'application/json',
description: 'Format GitHub will use when sending the webhook payload.',
required: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'github_issue_closed',
},
},
{
id: 'webhookSecret',
title: 'Webhook Secret',
type: 'short-input',
placeholder: 'Generate or enter a strong secret',
description: 'Validates that webhook deliveries originate from GitHub.',
password: true,
required: false,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'github_issue_closed',
},
},
{
id: 'sslVerification',
title: 'SSL Verification',
type: 'dropdown',
options: [
{ label: 'Enabled', id: 'enabled' },
{ label: 'Disabled', id: 'disabled' },
],
defaultValue: 'enabled',
description: 'GitHub verifies SSL certificates when delivering webhooks.',
required: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'github_issue_closed',
},
},
{
id: 'triggerInstructions',
title: 'Setup Instructions',
hideFromPreview: true,
type: 'text',
defaultValue: [
'Go to your GitHub Repository > Settings > Webhooks.',
'Click "Add webhook".',
'Paste the <strong>Webhook URL</strong> above into the "Payload URL" field.',
'Select your chosen Content Type from the dropdown.',
'Enter the <strong>Webhook Secret</strong> into the "Secret" field if you\'ve configured one.',
'Set SSL verification according to your selection.',
'Select "Let me select individual events" and check <strong>issues</strong> (<strong>closed</strong> action).',
'Ensure "Active" is checked and click "Add webhook".',
]
.map(
(instruction, index) =>
`<div class="mb-3"><strong>${index + 1}.</strong> ${instruction}</div>`
)
.join(''),
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'github_issue_closed',
},
},
],
outputs: {
event_type: {
type: 'string',
description:
'GitHub event type from X-GitHub-Event header (e.g., issues, pull_request, push)',
},
action: {
type: 'string',
description: 'Action performed (opened, closed, reopened, edited, etc.)',
},
issue: {
id: {
type: 'number',
description: 'Issue ID',
},
node_id: {
type: 'string',
description: 'Issue node ID',
},
number: {
type: 'number',
description: 'Issue number',
},
title: {
type: 'string',
description: 'Issue title',
},
body: {
type: 'string',
description: 'Issue body/description',
},
state: {
type: 'string',
description: 'Issue state (open, closed)',
},
state_reason: {
type: 'string',
description: 'Reason for state (completed, not_planned, reopened)',
},
html_url: {
type: 'string',
description: 'Issue HTML URL',
},
user: {
login: {
type: 'string',
description: 'Username',
},
id: {
type: 'number',
description: 'User ID',
},
node_id: {
type: 'string',
description: 'User node ID',
},
avatar_url: {
type: 'string',
description: 'Avatar URL',
},
html_url: {
type: 'string',
description: 'Profile URL',
},
user_type: {
type: 'string',
description: 'User type (User, Bot, Organization)',
},
},
labels: {
type: 'array',
description: 'Array of label objects',
},
assignees: {
type: 'array',
description: 'Array of assigned users',
},
milestone: {
type: 'object',
description: 'Milestone object if assigned',
},
created_at: {
type: 'string',
description: 'Issue creation timestamp',
},
updated_at: {
type: 'string',
description: 'Issue last update timestamp',
},
closed_at: {
type: 'string',
description: 'Issue closed timestamp',
},
},
repository: {
id: {
type: 'number',
description: 'Repository ID',
},
node_id: {
type: 'string',
description: 'Repository node ID',
},
name: {
type: 'string',
description: 'Repository name',
},
full_name: {
type: 'string',
description: 'Repository full name (owner/repo)',
},
private: {
type: 'boolean',
description: 'Whether the repository is private',
},
html_url: {
type: 'string',
description: 'Repository HTML URL',
},
repo_description: {
type: 'string',
description: 'Repository description',
},
fork: {
type: 'boolean',
description: 'Whether the repository is a fork',
},
url: {
type: 'string',
description: 'Repository API URL',
},
homepage: {
type: 'string',
description: 'Repository homepage URL',
},
size: {
type: 'number',
description: 'Repository size in KB',
},
stargazers_count: {
type: 'number',
description: 'Number of stars',
},
watchers_count: {
type: 'number',
description: 'Number of watchers',
},
language: {
type: 'string',
description: 'Primary programming language',
},
forks_count: {
type: 'number',
description: 'Number of forks',
},
open_issues_count: {
type: 'number',
description: 'Number of open issues',
},
default_branch: {
type: 'string',
description: 'Default branch name',
},
owner: {
login: {
type: 'string',
description: 'Owner username',
},
id: {
type: 'number',
description: 'Owner ID',
},
avatar_url: {
type: 'string',
description: 'Owner avatar URL',
},
html_url: {
type: 'string',
description: 'Owner profile URL',
},
owner_type: {
type: 'string',
description: 'Owner type (User, Organization)',
},
},
},
sender: {
login: {
type: 'string',
description: 'Username',
},
id: {
type: 'number',
description: 'User ID',
},
node_id: {
type: 'string',
description: 'User node ID',
},
avatar_url: {
type: 'string',
description: 'Avatar URL',
},
html_url: {
type: 'string',
description: 'Profile URL',
},
user_type: {
type: 'string',
description: 'User type (User, Bot, Organization)',
},
},
},
webhook: {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-GitHub-Event': 'issues',
'X-GitHub-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'X-Hub-Signature-256': 'sha256=...',
},
},
}