(query, variables = {})
| 26 | const GITHUB_REPO = "sourcebot-dev/sourcebot"; |
| 27 | |
| 28 | async function linearGraphQL(query, variables = {}) { |
| 29 | const apiKey = process.env.LINEAR_API_KEY; |
| 30 | if (!apiKey) { |
| 31 | throw new Error("LINEAR_API_KEY environment variable is required"); |
| 32 | } |
| 33 | |
| 34 | const response = await fetch(LINEAR_API_URL, { |
| 35 | method: "POST", |
| 36 | headers: { |
| 37 | "Content-Type": "application/json", |
| 38 | Authorization: apiKey, |
| 39 | }, |
| 40 | body: JSON.stringify({ query, variables }), |
| 41 | }); |
| 42 | |
| 43 | const result = await response.json(); |
| 44 | |
| 45 | if (result.errors) { |
| 46 | throw new Error(`Linear API error: ${JSON.stringify(result.errors)}`); |
| 47 | } |
| 48 | |
| 49 | return result.data; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Parse the changelog to extract PR numbers for a specific version |
no outgoing calls
no test coverage detected