62
"properties": {
63
"category": {
64
"type": "string",
65
- "enum": ["docs", "py", "ts", "cli", "tool-request", "feature-request", "other"]
65
+ "enum": ["docs", "py", "ts", "cli", "tool-request", "feature-request", "support", "other"]
66
},
67
"is_bug": {
68
"type": "boolean"
108
- cli
109
- tool-request
110
- feature-request
111
+ - support
112
- other
113
114
Use semantic meaning, not only keywords.
115
Choose tool-request when the issue is primarily asking for a new integration, toolkit, app, or tool.
116
Choose feature-request when the issue is asking for a product, SDK, docs, or CLI improvement that is not a tool request.
117
+ Choose support when the issue is primarily a product/support question or account/integration configuration problem rather than a code defect in this repository. This includes managed OAuth app configuration, provider app verification or consent-screen blocks, requested scopes for hosted/managed integrations, dashboard/back-office setup, billing/account questions, and usage questions where the SDK appears to be behaving as designed.
118
+ For example, an issue about Google Drive managed OAuth scopes or Google blocking the managed app should be support, not ts and not a bug, unless the issue clearly identifies a defect in SDK code.
119
Choose cli only when the issue is specifically about the CLI experience or ts/packages/cli.
120
Choose py only when the issue is primarily about the Python SDK.
121
Choose ts only when the issue is primarily about the TypeScript SDK or TS packages other than the CLI.
123
Never choose tool-request for a broken existing integration or tool. Those are bugs, not tool requests, even if the title/body mentions a tool name or toolkit slug.
124
Set is_bug to true when the issue is primarily reporting broken behavior, a defect, an error, a regression, or unexpected behavior.
125
Set is_bug to false for feature requests, questions, maintenance, cleanup, and true new-tool requests.
123
- Set should_comment to true only when the issue appears incorrect, non-actionable, or missing the information needed to reproduce or investigate.
126
+ Set should_comment to true when the issue appears incorrect, non-actionable, missing the information needed to reproduce or investigate, or when category is support.
127
Set should_comment to false otherwise.
128
129
If should_comment is true, provide comment_body as a short issue comment addressed to the reporter.
131
- clearly say it is an automated Claude triage note
132
- clearly say Claude cannot reply back in a conversation
133
- ask for the specific missing details needed to investigate, especially repro steps, expected behavior, actual behavior, environment, logs, or screenshots when relevant
134
+ - for support issues, say this does not look like an SDK bug and that it is being routed to support
135
- stay concise and professional
136
137
If should_comment is false, set comment_body to an empty string.
182
uses: actions/github-script@v8
183
env:
184
STRUCTURED_OUTPUT: ${{ steps.classify.outputs.structured_output }}
185
+ PLAIN_API_KEY: ${{ secrets.PLAIN_API_KEY }}
186
with:
187
script: |
188
const text = process.env.STRUCTURED_OUTPUT || "";
195
return;
196
}
197
193
- const allowed = new Set(["docs", "py", "ts", "cli", "tool-request", "feature-request", "other"]);
198
+ const allowed = new Set(["docs", "py", "ts", "cli", "tool-request", "feature-request", "support", "other"]);
199
if (!allowed.has(parsed.category)) {
200
core.setFailed(`Unexpected category: ${parsed.category}`);
201
return;
215
? "${{ steps.issue-context.outputs.issue_state }}"
216
: context.payload.issue.state;
217
218
+ const { data: issue } = await github.rest.issues.get({
219
+ owner,
220
+ repo,
221
+ issue_number,
222
+ });
223
+
224
const labels = [];
225
const assignees = [];
226
const suppressToolRequestHandling = isBug && category === "tool-request";
227
+ const isSupport = category === "support";
228
229
if (suppressToolRequestHandling) {
230
core.info(
232
);
233
}
234
223
- if (isBug) {
235
+ if (isBug && !isSupport) {
236
labels.push("bug");
237
}
238
250
assignees.push("CryogenicPlanet");
251
} else if (category === "feature-request") {
252
labels.push("feature-request");
253
+ } else if (isSupport) {
254
+ labels.push("support");
255
} else if (category === "tool-request" && !suppressToolRequestHandling) {
256
labels.push("tool-request");
257
}
258
259
+ async function ensureLabel(name, color, description) {
260
+ try {
261
+ await github.rest.issues.getLabel({ owner, repo, name });
262
+ } catch (error) {
263
+ if (error.status !== 404) throw error;
264
+ await github.rest.issues.createLabel({ owner, repo, name, color, description });
265
+ }
266
+ }
267
+
268
+ if (isSupport) {
269
+ await ensureLabel("support", "0e8a16", "Needs support team follow-up");
270
+ for (const staleLabel of ["bug", "ts"]) {
271
+ try {
272
+ await github.rest.issues.removeLabel({ owner, repo, issue_number, name: staleLabel });
273
+ } catch (error) {
274
+ if (error.status !== 404) throw error;
275
+ }
276
+ }
277
+ try {
278
+ await github.rest.issues.removeAssignees({
279
+ owner,
280
+ repo,
281
+ issue_number,
282
+ assignees: ["jkomyno"],
283
+ });
284
+ } catch (error) {
285
+ if (error.status !== 404) throw error;
286
+ }
287
+ }
288
+
289
if (labels.length > 0) {
290
await github.rest.issues.addLabels({
291
owner,
305
}
306
307
if (
308
+ !isSupport &&
309
(category !== "tool-request" || suppressToolRequestHandling) &&
310
shouldComment &&
311
commentBody.trim().length > 0
318
});
319
}
320
321
+ async function plainGraphql(query, variables) {
322
+ const apiKey = process.env.PLAIN_API_KEY;
323
+ if (!apiKey) {
324
+ core.warning("PLAIN_API_KEY is not configured; skipping Plain support forwarding.");
325
+ return null;
326
+ }
327
+
328
+ const response = await fetch("https://core-api.uk.plain.com/graphql/v1", {
329
+ method: "POST",
330
+ headers: {
331
+ "Authorization": `Bearer ${apiKey}`,
332
+ "Content-Type": "application/json",
333
+ },
334
+ body: JSON.stringify({ query, variables }),
335
+ });
336
+ const json = await response.json().catch(() => ({}));
337
+ if (!response.ok || json.errors) {
338
+ core.warning(`Plain API request failed: ${JSON.stringify(json)}`);
339
+ return null;
340
+ }
341
+ return json.data;
342
+ }
343
+
344
+ async function getIssueAuthorPlainCustomer() {
345
+ const login = issue.user?.login || "unknown";
346
+ let publicEmail = issue.user?.email || null;
347
+ let displayName = issue.user?.name || login;
348
+
349
+ if (login !== "unknown") {
350
+ try {
351
+ const { data: user } = await github.rest.users.getByUsername({ username: login });
352
+ publicEmail = user.email || publicEmail;
353
+ displayName = user.name || displayName;
354
+ } catch (error) {
355
+ core.warning(`Could not fetch GitHub user profile for ${login}: ${error.message}`);
356
+ }
357
+ }
358
+
359
+ return {
360
+ email: publicEmail || (issue.user?.id ? `${issue.user.id}+${login}@users.noreply.github.com` : `${login}@users.noreply.github.com`),
361
+ fullName: displayName,
362
+ shortName: login,
363
+ externalId: `github:user:${login}`,
364
+ };
365
+ }
366
+
367
+ async function forwardSupportIssueToPlain() {
368
+ const plainCustomer = await getIssueAuthorPlainCustomer();
369
+ const customerData = await plainGraphql(
370
+ `mutation upsertCustomer($input: UpsertCustomerInput!) {
371
+ upsertCustomer(input: $input) {
372
+ result
373
+ customer { id }
374
+ error { message type code fields { field message type } }
375
+ }
376
+ }`,
377
+ {
378
+ input: {
379
+ identifier: { emailAddress: plainCustomer.email },
380
+ onCreate: {
381
+ fullName: plainCustomer.fullName,
382
+ shortName: plainCustomer.shortName,
383
+ email: { email: plainCustomer.email, isVerified: Boolean(issue.user?.email) },
384
+ externalId: plainCustomer.externalId,
385
+ },
386
+ onUpdate: {
387
+ fullName: { value: plainCustomer.fullName },
388
+ shortName: { value: plainCustomer.shortName },
389
+ externalId: { value: plainCustomer.externalId },
390
+ },
391
+ },
392
+ }
393
+ );
394
+ const customer = customerData?.upsertCustomer?.customer;
395
+ const customerError = customerData?.upsertCustomer?.error;
396
+ if (!customer?.id) {
397
+ core.warning(`Could not upsert Plain support customer: ${JSON.stringify(customerError)}`);
398
+ return null;
399
+ }
400
+
401
+ const body = issue.body || "_No issue body provided._";
402
+ const plainText = [
403
+ `GitHub issue routed as support: ${issue.html_url}`,
404
+ `Reporter: @${issue.user?.login || "unknown"}`,
405
+ `Classification reason: ${reason || "No reason provided."}`,
406
+ "",
407
+ "Issue body:",
408
+ body.length > 8000 ? `${body.slice(0, 8000)}\n\n[truncated]` : body,
409
+ ].join("\n");
410
+
411
+ const threadData = await plainGraphql(
412
+ `mutation createThread($input: CreateThreadInput!) {
413
+ createThread(input: $input) {
414
+ thread { id ref }
415
+ error { message type code fields { field message type } }
416
+ }
417
+ }`,
418
+ {
419
+ input: {
420
+ title: `[GitHub #${issue.number}] ${issue.title}`,
421
+ customerIdentifier: { customerId: customer.id },
422
+ externalId: `github:${owner}/${repo}:issues/${issue.number}`,
423
+ components: [{ componentText: { text: plainText } }],
424
+ },
425
+ }
426
+ );
427
+ const thread = threadData?.createThread?.thread;
428
+ const threadError = threadData?.createThread?.error;
429
+ if (!thread?.id) {
430
+ core.warning(`Could not create Plain support thread: ${JSON.stringify(threadError)}`);
431
+ return null;
432
+ }
433
+ core.info(`Forwarded support issue #${issue.number} to Plain thread ${thread.ref || thread.id}`);
434
+ return thread;
435
+ }
436
+
437
+ if (isSupport) {
438
+ const thread = await forwardSupportIssueToPlain();
439
+ await github.rest.issues.createComment({
440
+ owner,
441
+ repo,
442
+ issue_number,
443
+ body: thread
444
+ ? `🤖 Automated Claude triage note: this does not look like an SDK bug, so I've labeled it as \`support\` and forwarded it to Plain for the support team. Claude cannot reply back in a conversation.`
445
+ : `🤖 Automated Claude triage note: this does not look like an SDK bug, so I've labeled it as \`support\` for support team follow-up. Claude cannot reply back in a conversation.`,
446
+ });
447
+ }
448
+
449
if (category === "tool-request" && !suppressToolRequestHandling && issueState === "open") {
450
await github.rest.issues.createComment({
451
owner,