( repo: GitHubRepo, prNumber: number, comment: GitHubComment )
| 105 | } |
| 106 | |
| 107 | export function transformPRComment( |
| 108 | repo: GitHubRepo, prNumber: number, comment: GitHubComment |
| 109 | ): PatchOp[] { |
| 110 | const parentUri = `github://${repo.owner}/${repo.repo}/pull/${prNumber}`; |
| 111 | const commentUri = `${parentUri}/comments/${comment.id}`; |
| 112 | const parentId = deterministicId(parentUri); |
| 113 | const commentId = deterministicId(commentUri); |
| 114 | const edgeId = deterministicId(`${parentUri}:CONTAINS:${commentUri}`); |
| 115 | return [ |
| 116 | { |
| 117 | type: "UpsertNode", |
| 118 | id: commentId, |
| 119 | kind: "doc", |
| 120 | name: `PR #${prNumber} review by ${comment.user?.login ?? "unknown"}`, |
| 121 | attrs: { |
| 122 | url: comment.html_url, |
| 123 | author: comment.user?.login ?? "unknown", |
| 124 | created_at: comment.created_at, |
| 125 | body: truncate(comment.body, 2000), |
| 126 | source_uri: commentUri, |
| 127 | }, |
| 128 | }, |
| 129 | { |
| 130 | type: "UpsertEdge", |
| 131 | id: edgeId, |
| 132 | src: parentId, |
| 133 | dst: commentId, |
| 134 | predicate: "CONTAINS", |
| 135 | attrs: {}, |
| 136 | }, |
| 137 | ]; |
| 138 | } |
| 139 | |
| 140 | export function transformCommit(repo: GitHubRepo, commit: GitHubCommit): PatchOp[] { |
| 141 | const uri = `github://${repo.owner}/${repo.repo}/commit/${commit.sha}`; |
no test coverage detected