| 1361 | } |
| 1362 | |
| 1363 | async function fetchIssue() { |
| 1364 | console.log("Fetching prompt data for issue...") |
| 1365 | const issueResult = await octoGraph<IssueQueryResponse>( |
| 1366 | ` |
| 1367 | query($owner: String!, $repo: String!, $number: Int!) { |
| 1368 | repository(owner: $owner, name: $repo) { |
| 1369 | issue(number: $number) { |
| 1370 | title |
| 1371 | body |
| 1372 | author { |
| 1373 | login |
| 1374 | } |
| 1375 | createdAt |
| 1376 | state |
| 1377 | comments(first: 100) { |
| 1378 | nodes { |
| 1379 | id |
| 1380 | databaseId |
| 1381 | body |
| 1382 | author { |
| 1383 | login |
| 1384 | } |
| 1385 | createdAt |
| 1386 | } |
| 1387 | } |
| 1388 | } |
| 1389 | } |
| 1390 | }`, |
| 1391 | { |
| 1392 | owner, |
| 1393 | repo, |
| 1394 | number: issueId, |
| 1395 | }, |
| 1396 | ) |
| 1397 | |
| 1398 | const issue = issueResult.repository.issue |
| 1399 | if (!issue) throw new Error(`Issue #${issueId} not found`) |
| 1400 | |
| 1401 | return issue |
| 1402 | } |
| 1403 | |
| 1404 | function buildPromptDataForIssue(issue: GitHubIssue) { |
| 1405 | // Only called for non-schedule events, so payload is defined |