@@ -10,21 +10,7 @@ import * as exec from '@actions/exec';
1010import { Octokit } from '@octokit/rest' ;
1111import { Auggie } from '@augmentcode/auggie-sdk' ;
1212
13- /**
14- * Valid GitHub reaction types
15- */
16- const VALID_REACTIONS = [
17- '+1' ,
18- '-1' ,
19- 'laugh' ,
20- 'confused' ,
21- 'heart' ,
22- 'hooray' ,
23- 'rocket' ,
24- 'eyes' ,
25- ] as const ;
26-
27- type ReactionType = ( typeof VALID_REACTIONS ) [ number ] ;
13+
2814
2915/**
3016 * PR Context gathered from GitHub
@@ -81,64 +67,7 @@ function parseRepository(): { owner: string; repo: string } {
8167 return { owner, repo } ;
8268}
8369
84- /**
85- * Validate reaction type
86- */
87- function validateReaction ( reaction : string ) : ReactionType {
88- if ( ! VALID_REACTIONS . includes ( reaction as ReactionType ) ) {
89- throw new Error (
90- `Invalid reaction type: ${ reaction } . Valid reactions: ${ VALID_REACTIONS . join ( ', ' ) } `
91- ) ;
92- }
93- return reaction as ReactionType ;
94- }
9570
96- /**
97- * Add reaction to a comment
98- */
99- async function addReaction (
100- octokit : Octokit ,
101- owner : string ,
102- repo : string ,
103- commentId : number ,
104- eventName : string ,
105- reaction : ReactionType
106- ) : Promise < void > {
107- try {
108- if ( eventName === 'pull_request_review_comment' ) {
109- await octokit . rest . reactions . createForPullRequestReviewComment ( {
110- owner,
111- repo,
112- comment_id : commentId ,
113- content : reaction ,
114- } ) ;
115- core . info ( `✅ Added :${ reaction } : reaction to PR review comment ${ commentId } ` ) ;
116- } else if ( eventName === 'issue_comment' ) {
117- await octokit . rest . reactions . createForIssueComment ( {
118- owner,
119- repo,
120- comment_id : commentId ,
121- content : reaction ,
122- } ) ;
123- core . info ( `✅ Added :${ reaction } : reaction to issue comment ${ commentId } ` ) ;
124- } else {
125- throw new Error (
126- `Unsupported event type: ${ eventName } . Supported: pull_request_review_comment, issue_comment`
127- ) ;
128- }
129- } catch ( error ) {
130- if ( error instanceof Error ) {
131- // biome-ignore lint/suspicious/noExplicitAny: POC
132- const apiError = error as any ;
133- const requestId = apiError . response ?. headers ?. [ 'x-github-request-id' ] || 'unknown' ;
134- const status = apiError . status || '' ;
135- throw new Error (
136- `Failed to add :${ reaction } : reaction (${ status } ): ${ error . message } ; requestId=${ requestId } `
137- ) ;
138- }
139- throw error ;
140- }
141- }
14271
14372/**
14473 * Get PR number from comment
@@ -423,25 +352,19 @@ async function main(): Promise<void> {
423352 const githubToken = getInput ( 'github_token' , true ) ;
424353 const commentIdStr = getInput ( 'comment_id' , true ) ;
425354 const eventName = getInput ( 'event_name' , true ) ;
426- const reactionInput = getInput ( 'reaction' ) || 'eyes' ;
427355
428356 // Validate inputs
429357 const commentId = Number . parseInt ( commentIdStr , 10 ) ;
430358 if ( Number . isNaN ( commentId ) ) {
431359 throw new Error ( `Invalid comment_id: ${ commentIdStr } . Must be a number.` ) ;
432360 }
433361
434- const reaction = validateReaction ( reactionInput ) ;
435362 const { owner , repo } = parseRepository ( ) ;
436363
437364 // Create Octokit instance
438365 const octokit = new Octokit ( { auth : githubToken } ) ;
439366
440- // Step 1: Add reaction IMMEDIATELY to give user quick feedback
441- core . info ( '👀 Adding reaction to comment for quick feedback...' ) ;
442- await addReaction ( octokit , owner , repo , commentId , eventName , reaction ) ;
443-
444- // Now start the actual processing
367+ // Note: Reaction is added in action.yml for immediate feedback
445368 core . info ( `🎯 Starting PR Assistant for comment ${ commentId } ` ) ;
446369 core . info ( `📦 Repository: ${ owner } /${ repo } ` ) ;
447370 core . info ( `📝 Event: ${ eventName } ` ) ;
0 commit comments