Skip to content

Commit 15f17d2

Browse files
nicktrnmatt-aitken
andauthored
Going exponential with Linear (#478)
* Unleash GPT magic * Clean up after GPT * All the hooks * Provisional integration catalog entry * Sample webhook jobs * Attachments with alpha warnings * Remove some verbose logs * Fix IP restrictions * Remove tunnel * Revert "Remove tunnel" This reverts commit c5b69ce. * Resolve event name clashes * Remove circular dependency * Use correct payload uuid * Schema fixes * Fix webhook event name * Start to Linearify catalog entry * Remove todo * More catalog updates * Make OAuth work * Rename webhook helper * Schema juggling * More discrimination * Add Issue SLA event * Simplify triggers * Handle rate limits * Fix Project schema * Payload examples * Improve event props * Remove redundant source metadata * One type to rule them all * Recursive WithoutFunctions type * Linear output serializer * Some tasks * Update catalog entry * Dynamic usage sample * Bump version * Remove tunnel * More tasks * Add optional skipRetrying on runTask errors * Fail fast on user errors * Entity getter tasks * Another couple of tasks * Token to apiKey * Sort tasks * Add filtered issue SLA triggers * Add docs * Type fixes * Job catalog examples * Serialization helper docs * Add changeset * Refactor webhooks * Enhance properties * Pagination helper and docs * Clean up imports * Change misc catalog job --------- Co-authored-by: Matt Aitken <[email protected]>
1 parent 91fc1e8 commit 15f17d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+5433
-9
lines changed

.changeset/strange-gorillas-kick.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"@trigger.dev/linear": patch
4+
---
5+
6+
First release of `@trigger.dev/linear` integration. `io.runTask()` error handlers can now prevent further retries.

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ CLOUD_AIRTABLE_CLIENT_ID=
3131
CLOUD_AIRTABLE_CLIENT_SECRET=
3232
CLOUD_GITHUB_CLIENT_ID=
3333
CLOUD_GITHUB_CLIENT_SECRET=
34+
CLOUD_LINEAR_CLIENT_ID=
35+
CLOUD_LINEAR_CLIENT_SECRET=
3436
CLOUD_SLACK_APP_HOST=
3537
CLOUD_SLACK_CLIENT_ID=
3638
CLOUD_SLACK_CLIENT_SECRET=

apps/webapp/app/services/externalApis/integrationCatalog.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { airtable } from "./integrations/airtable";
22
import { github } from "./integrations/github";
3+
import { linear } from "./integrations/linear";
34
import { openai } from "./integrations/openai";
45
import { plain } from "./integrations/plain";
56
import { resend } from "./integrations/resend";
@@ -33,6 +34,7 @@ export class IntegrationCatalog {
3334
export const integrationCatalog = new IntegrationCatalog({
3435
airtable,
3536
github,
37+
linear,
3638
openai,
3739
plain,
3840
resend,
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
import type { HelpSample, Integration } from "../types";
2+
3+
function usageSample(hasApiKey: boolean): HelpSample {
4+
return {
5+
title: "Using the client",
6+
code: `
7+
import { Linear } from "@trigger.dev/linear";
8+
9+
const linear = new Linear({
10+
id: "__SLUG__",${hasApiKey ? ",\n apiKey: process.env.LINEAR_API_KEY!" : ""}
11+
});
12+
13+
client.defineJob({
14+
id: "linear-react-to-new-issue",
15+
name: "Linear - React To New Issue",
16+
version: "0.1.0",
17+
integrations: { linear },
18+
trigger: linear.onIssueCreated(),
19+
run: async (payload, io, ctx) => {
20+
await io.linear.createComment("create-comment", {
21+
issueId: payload.data.id,
22+
body: "Thank's for opening this issue!"
23+
});
24+
25+
await io.linear.createReaction("create-reaction", {
26+
issueId: payload.data.id,
27+
emoji: "+1"
28+
});
29+
30+
return { payload, ctx };
31+
},
32+
});
33+
`,
34+
};
35+
}
36+
37+
export const linear: Integration = {
38+
identifier: "linear",
39+
name: "Linear",
40+
packageName: "@trigger.dev/linear@latest",
41+
authenticationMethods: {
42+
oauth2: {
43+
name: "OAuth",
44+
type: "oauth2",
45+
client: {
46+
id: {
47+
envName: "CLOUD_LINEAR_CLIENT_ID",
48+
},
49+
secret: {
50+
envName: "CLOUD_LINEAR_CLIENT_SECRET",
51+
},
52+
},
53+
config: {
54+
authorization: {
55+
url: "https://linear.app/oauth/authorize",
56+
scopeSeparator: ",",
57+
},
58+
token: {
59+
url: "https://api.linear.app/oauth/token",
60+
metadata: {},
61+
},
62+
refresh: {
63+
url: "https://linear.app/oauth/authorize",
64+
},
65+
pkce: false,
66+
},
67+
scopes: [
68+
{
69+
name: "write",
70+
description:
71+
"Grants global write access to the user's account. Use a more targeted scope if you don't need full access.",
72+
defaultChecked: true,
73+
},
74+
75+
{
76+
name: "issue:create",
77+
description: "Grants access to create issues and attachments only.",
78+
annotations: [{ label: "Issues" }],
79+
},
80+
81+
{
82+
name: "comments:create",
83+
description: "Grants access to create new issue comments.",
84+
annotations: [{ label: "Comments" }],
85+
},
86+
87+
{
88+
name: "admin",
89+
description:
90+
"Grants full access to admin-level endpoints. Don't use this unless you really need it.",
91+
},
92+
],
93+
help: {
94+
samples: [usageSample(false)],
95+
},
96+
},
97+
apikey: {
98+
type: "apikey",
99+
help: {
100+
samples: [usageSample(true)],
101+
},
102+
},
103+
},
104+
};

0 commit comments

Comments
 (0)