(commentType?: "issue" | "pr_review")
| 1203 | } |
| 1204 | |
| 1205 | async function removeReaction(commentType?: "issue" | "pr_review") { |
| 1206 | // Only called for non-schedule events, so triggerCommentId is defined |
| 1207 | console.log("Removing reaction...") |
| 1208 | if (triggerCommentId) { |
| 1209 | if (commentType === "pr_review") { |
| 1210 | const reactions = await octoRest.rest.reactions.listForPullRequestReviewComment({ |
| 1211 | owner, |
| 1212 | repo, |
| 1213 | comment_id: triggerCommentId!, |
| 1214 | content: AGENT_REACTION, |
| 1215 | }) |
| 1216 | |
| 1217 | const eyesReaction = reactions.data.find((r) => r.user?.login === AGENT_USERNAME) |
| 1218 | if (!eyesReaction) return |
| 1219 | |
| 1220 | return await octoRest.rest.reactions.deleteForPullRequestComment({ |
| 1221 | owner, |
| 1222 | repo, |
| 1223 | comment_id: triggerCommentId!, |
| 1224 | reaction_id: eyesReaction.id, |
| 1225 | }) |
| 1226 | } |
| 1227 | |
| 1228 | const reactions = await octoRest.rest.reactions.listForIssueComment({ |
| 1229 | owner, |
| 1230 | repo, |
| 1231 | comment_id: triggerCommentId!, |
| 1232 | content: AGENT_REACTION, |
| 1233 | }) |
| 1234 | |
| 1235 | const eyesReaction = reactions.data.find((r) => r.user?.login === AGENT_USERNAME) |
| 1236 | if (!eyesReaction) return |
| 1237 | |
| 1238 | return await octoRest.rest.reactions.deleteForIssueComment({ |
| 1239 | owner, |
| 1240 | repo, |
| 1241 | comment_id: triggerCommentId!, |
| 1242 | reaction_id: eyesReaction.id, |
| 1243 | }) |
| 1244 | } |
| 1245 | |
| 1246 | const reactions = await octoRest.rest.reactions.listForIssue({ |
| 1247 | owner, |
| 1248 | repo, |
| 1249 | issue_number: issueId!, |
| 1250 | content: AGENT_REACTION, |
| 1251 | }) |
| 1252 | |
| 1253 | const eyesReaction = reactions.data.find((r) => r.user?.login === AGENT_USERNAME) |
| 1254 | if (!eyesReaction) return |
| 1255 | |
| 1256 | await octoRest.rest.reactions.deleteForIssue({ |
| 1257 | owner, |
| 1258 | repo, |
| 1259 | issue_number: issueId!, |
| 1260 | reaction_id: eyesReaction.id, |
| 1261 | }) |
| 1262 | } |
no test coverage detected