@@ -418,6 +418,7 @@ export const GithubRunCommand = cmd({
418418 type PromptFiles = Awaited < ReturnType < typeof getUserPrompt > > [ "promptFiles" ]
419419 const triggerCommentId = payload . comment . id
420420 const useGithubToken = normalizeUseGithubToken ( )
421+ const commentType = context . eventName === "pull_request_review_comment" ? "pr_review" : "issue"
421422
422423 try {
423424 if ( useGithubToken ) {
@@ -443,7 +444,7 @@ export const GithubRunCommand = cmd({
443444 }
444445 await assertPermissions ( )
445446
446- await addReaction ( )
447+ await addReaction ( commentType )
447448
448449 // Setup opencode session
449450 const repoData = await fetchRepo ( )
@@ -476,7 +477,7 @@ export const GithubRunCommand = cmd({
476477 }
477478 const hasShared = prData . comments . nodes . some ( ( c ) => c . body . includes ( `${ shareBaseUrl } /s/${ shareId } ` ) )
478479 await createComment ( `${ response } ${ footer ( { image : ! hasShared } ) } ` )
479- await removeReaction ( )
480+ await removeReaction ( commentType )
480481 }
481482 // Fork PR
482483 else {
@@ -491,7 +492,7 @@ export const GithubRunCommand = cmd({
491492 }
492493 const hasShared = prData . comments . nodes . some ( ( c ) => c . body . includes ( `${ shareBaseUrl } /s/${ shareId } ` ) )
493494 await createComment ( `${ response } ${ footer ( { image : ! hasShared } ) } ` )
494- await removeReaction ( )
495+ await removeReaction ( commentType )
495496 }
496497 }
497498 // Issue
@@ -512,10 +513,10 @@ export const GithubRunCommand = cmd({
512513 `${ response } \n\nCloses #${ issueId } ${ footer ( { image : true } ) } ` ,
513514 )
514515 await createComment ( `Created PR #${ pr } ${ footer ( { image : true } ) } ` )
515- await removeReaction ( )
516+ await removeReaction ( commentType )
516517 } else {
517518 await createComment ( `${ response } ${ footer ( { image : true } ) } ` )
518- await removeReaction ( )
519+ await removeReaction ( commentType )
519520 }
520521 }
521522 } catch ( e : any ) {
@@ -528,7 +529,7 @@ export const GithubRunCommand = cmd({
528529 msg = e . message
529530 }
530531 await createComment ( `${ msg } ${ footer ( ) } ` )
531- await removeReaction ( )
532+ await removeReaction ( commentType )
532533 core . setFailed ( msg )
533534 // Also output the clean error message for the action to capture
534535 //core.setOutput("prepare_error", e.message);
@@ -977,8 +978,16 @@ Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"`
977978 if ( ! [ "admin" , "write" ] . includes ( permission ) ) throw new Error ( `User ${ actor } does not have write permissions` )
978979 }
979980
980- async function addReaction ( ) {
981+ async function addReaction ( commentType : "issue" | "pr_review" ) {
981982 console . log ( "Adding reaction..." )
983+ if ( commentType === "pr_review" ) {
984+ return await octoRest . rest . reactions . createForPullRequestReviewComment ( {
985+ owner,
986+ repo,
987+ comment_id : triggerCommentId ,
988+ content : AGENT_REACTION ,
989+ } )
990+ }
982991 return await octoRest . rest . reactions . createForIssueComment ( {
983992 owner,
984993 repo,
@@ -987,8 +996,28 @@ Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"`
987996 } )
988997 }
989998
990- async function removeReaction ( ) {
999+ async function removeReaction ( commentType : "issue" | "pr_review" ) {
9911000 console . log ( "Removing reaction..." )
1001+ if ( commentType === "pr_review" ) {
1002+ const reactions = await octoRest . rest . reactions . listForPullRequestReviewComment ( {
1003+ owner,
1004+ repo,
1005+ comment_id : triggerCommentId ,
1006+ content : AGENT_REACTION ,
1007+ } )
1008+
1009+ const eyesReaction = reactions . data . find ( ( r ) => r . user ?. login === AGENT_USERNAME )
1010+ if ( ! eyesReaction ) return
1011+
1012+ await octoRest . rest . reactions . deleteForPullRequestComment ( {
1013+ owner,
1014+ repo,
1015+ comment_id : triggerCommentId ,
1016+ reaction_id : eyesReaction . id ,
1017+ } )
1018+ return
1019+ }
1020+
9921021 const reactions = await octoRest . rest . reactions . listForIssueComment ( {
9931022 owner,
9941023 repo,
0 commit comments