()
| 843 | } |
| 844 | |
| 845 | async function fetchIssue() { |
| 846 | console.log("Fetching prompt data for issue...") |
| 847 | const { repo } = useContext() |
| 848 | const issueResult = await octoGraph<IssueQueryResponse>( |
| 849 | ` |
| 850 | query($owner: String!, $repo: String!, $number: Int!) { |
| 851 | repository(owner: $owner, name: $repo) { |
| 852 | issue(number: $number) { |
| 853 | title |
| 854 | body |
| 855 | author { |
| 856 | login |
| 857 | } |
| 858 | createdAt |
| 859 | state |
| 860 | comments(first: 100) { |
| 861 | nodes { |
| 862 | id |
| 863 | databaseId |
| 864 | body |
| 865 | author { |
| 866 | login |
| 867 | } |
| 868 | createdAt |
| 869 | } |
| 870 | } |
| 871 | } |
| 872 | } |
| 873 | }`, |
| 874 | { |
| 875 | owner: repo.owner, |
| 876 | repo: repo.repo, |
| 877 | number: useIssueId(), |
| 878 | }, |
| 879 | ) |
| 880 | |
| 881 | const issue = issueResult.repository.issue |
| 882 | if (!issue) throw new Error(`Issue #${useIssueId()} not found`) |
| 883 | |
| 884 | return issue |
| 885 | } |
| 886 | |
| 887 | function buildPromptDataForIssue(issue: GitHubIssue) { |
| 888 | const payload = useContext().payload as IssueCommentEvent |
no test coverage detected