@@ -7,6 +7,7 @@ import { Handler } from '~common/interfaces';
77import { Config , FileContent , WalkthroughObject } from '~common/types' ;
88import { aiConfig , appConfig } from '~configs' ;
99import { SystemError } from '~errors' ;
10+ import { addMetadataToComment } from '~helpers' ;
1011import { walkthroughObjectSchema } from '~schemas' ;
1112import { AiService , CacheService , GitHubService , QueueService , TemplateService } from '~services' ;
1213import { walkthroughCommentTemplate , walkthroughPromptTemplate , walkthroughSystemTemplate } from '~templates' ;
@@ -32,23 +33,23 @@ export class WalkthroughHandler implements Handler<'pull_request'> {
3233 const changes = this . generateMarkdown ( walkthroughObject . changes ) ;
3334
3435 if ( existingComment ?. id ) {
35- await this . queueService . schedule ( ( ) =>
36- GitHubService . updateComment (
37- context ,
38- existingComment . id ,
39- TemplateService . render ( walkthroughCommentTemplate , {
40- description : walkthroughObject . description ,
41- changes,
42- commentType : appConfig . metadata . walkthrough
43- } )
44- )
36+ const commentBody = addMetadataToComment (
37+ TemplateService . render ( walkthroughCommentTemplate , {
38+ description : walkthroughObject . description ,
39+ changes
40+ } ) ,
41+ appConfig . metadata . walkthrough
4542 ) ;
43+
44+ await this . queueService . schedule ( ( ) => GitHubService . updateComment ( context , existingComment . id , commentBody ) ) ;
4645 } else {
47- const commentBody = TemplateService . render ( walkthroughCommentTemplate , {
48- description : walkthroughObject . description ,
49- changes,
50- commentType : appConfig . metadata . walkthrough
51- } ) ;
46+ const commentBody = addMetadataToComment (
47+ TemplateService . render ( walkthroughCommentTemplate , {
48+ description : walkthroughObject . description ,
49+ changes
50+ } ) ,
51+ appConfig . metadata . walkthrough
52+ ) ;
5253
5354 await this . queueService . schedule ( ( ) => GitHubService . createComment ( context , commentBody ) ) ;
5455 }
0 commit comments