in src/github/operations/comments/feedback.ts [33:97]
async function addThumbsUpToTriggerComment(
octokit: Octokit,
context: JunieExecutionContext,
): Promise<void> {
try {
const reaction = '+1';
const {owner, name} = context.payload.repository;
const ownerLogin = owner.login;
// Handle pull request review event - add reactions to all review comments
if (isPullRequestReviewEvent(context)) {
const reviewId = context.payload.review.id;
console.log(`Pull request review detected - adding thumbs up to all review comments (review ID: ${reviewId})`);
// Get all comments from this review
const {data: reviewComments} = await octokit.rest.pulls.listCommentsForReview({
owner: ownerLogin,
repo: name,
pull_number: context.entityNumber!,
review_id: reviewId,
});
console.log(`Found ${reviewComments.length} comments in the review`);
// Add thumbs up reaction to each review comment
for (const comment of reviewComments) {
try {
await octokit.rest.reactions.createForPullRequestReviewComment({
owner: ownerLogin,
repo: name,
comment_id: comment.id,
content: reaction,
});
console.log(`✓ Added thumbs up reaction to review comment ${comment.id}`);
} catch (commentError) {
console.warn(`Failed to add reaction to review comment ${comment.id}:`, commentError);
}
}
return;
} else if (isIssueCommentEvent(context)) {
const commentId = context.payload.comment.id;
console.log(`Issue comment detected - adding thumbs (comment ID: ${commentId})`);
await octokit.rest.reactions.createForIssueComment({
owner: ownerLogin,
repo: name,
comment_id: commentId,
content: reaction,
});
console.log(`✓ Added thumbs up reaction to comment ${commentId}`);
} else if (isPullRequestReviewCommentEvent(context)) {
const commentId = context.payload.comment.id;
console.log(`Pull Request review comment detected - adding thumbs (review comment ID: ${commentId})`);
await octokit.rest.reactions.createForPullRequestReviewComment({
owner: ownerLogin,
repo: name,
comment_id: commentId,
content: reaction,
});
console.log(`✓ Added thumbs up reaction to review comment ${commentId}`);
} else {
console.log('Not a comment/review event - skipping thumbs up reaction');
return;
}
} catch (error) {
// Don't fail the workflow if we can't add a reaction
console.warn('Failed to add thumbs up reaction to trigger comment:', error);
}
}