@@ -76,6 +76,21 @@ async function run(): Promise<void> {
7676 let headSha : string ;
7777 let eventType : 'push' | 'comment' ;
7878 let command = null ;
79+ let commentId : number | null = null ;
80+
81+ const addCommentReaction = async ( content : 'eyes' | 'hooray' | 'confused' ) => {
82+ if ( commentId === null ) return ;
83+ try {
84+ await octokit . rest . reactions . createForIssueComment ( {
85+ owner,
86+ repo,
87+ comment_id : commentId ,
88+ content,
89+ } ) ;
90+ } catch {
91+ // Non-fatal
92+ }
93+ } ;
7994
8095 if ( eventName === 'issue_comment' ) {
8196 // Only handle comments on PRs, not plain issues
@@ -92,20 +107,9 @@ async function run(): Promise<void> {
92107 }
93108
94109 pullNumber = context . payload . issue ! . number ;
110+ commentId = context . payload . comment ! . id ;
95111 eventType = 'comment' ;
96112
97- // Acknowledge the command with a reaction
98- try {
99- await octokit . rest . reactions . createForIssueComment ( {
100- owner,
101- repo,
102- comment_id : context . payload . comment ! . id ,
103- content : 'eyes' ,
104- } ) ;
105- } catch {
106- // Non-fatal: reaction is best-effort
107- }
108-
109113 // Fetch PR details to get base/head SHAs
110114 const pr = await octokit . rest . pulls . get ( { owner, repo, pull_number : pullNumber } ) ;
111115 baseSha = pr . data . base . sha ;
@@ -212,6 +216,10 @@ async function run(): Promise<void> {
212216 core . info ( `Demo comment posted: ${ comment . url } ` ) ;
213217 core . setOutput ( 'comment-url' , comment . url ) ;
214218 core . setOutput ( 'success' , String ( result . success ) ) ;
219+ await addCommentReaction ( 'hooray' ) ;
220+ } catch ( err ) {
221+ await addCommentReaction ( 'confused' ) ;
222+ throw err ;
215223 } finally {
216224 appProcess ?. kill ( ) ;
217225 }
0 commit comments