( repo: GitHubRepo, issueNumber: number, comment: GitHubComment )
| 45 | } |
| 46 | |
| 47 | export function transformIssueComment( |
| 48 | repo: GitHubRepo, issueNumber: number, comment: GitHubComment |
| 49 | ): PatchOp[] { |
| 50 | const parentUri = `github://${repo.owner}/${repo.repo}/issues/${issueNumber}`; |
| 51 | const commentUri = `${parentUri}/comments/${comment.id}`; |
| 52 | const parentId = deterministicId(parentUri); |
| 53 | const commentId = deterministicId(commentUri); |
| 54 | const edgeId = deterministicId(`${parentUri}:CONTAINS:${commentUri}`); |
| 55 | return [ |
| 56 | { |
| 57 | type: "UpsertNode", |
| 58 | id: commentId, |
| 59 | kind: "doc", |
| 60 | name: `Issue #${issueNumber} comment by ${comment.user?.login ?? "unknown"}`, |
| 61 | attrs: { |
| 62 | url: comment.html_url, |
| 63 | author: comment.user?.login ?? "unknown", |
| 64 | created_at: comment.created_at, |
| 65 | body: truncate(comment.body, 2000), |
| 66 | source_uri: commentUri, |
| 67 | }, |
| 68 | }, |
| 69 | { |
| 70 | type: "UpsertEdge", |
| 71 | id: edgeId, |
| 72 | src: parentId, |
| 73 | dst: commentId, |
| 74 | predicate: "CONTAINS", |
| 75 | attrs: {}, |
| 76 | }, |
| 77 | ]; |
| 78 | } |
| 79 | |
| 80 | export function transformPR(repo: GitHubRepo, pr: GitHubPR): PatchOp[] { |
| 81 | const uri = `github://${repo.owner}/${repo.repo}/pull/${pr.number}`; |
no test coverage detected