@@ -9,23 +9,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
99 } ) ;
1010} ;
1111Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
12- const HEADER = "<!-- Sticky Pull Request Comment -->" ;
13- function findPreviousComment ( octokit , repo , issue_number ) {
12+ function headerComment ( header ) {
13+ return `<!-- Sticky Pull Request Comment${ header } -->` ;
14+ }
15+ function findPreviousComment ( octokit , repo , issue_number , header ) {
1416 return __awaiter ( this , void 0 , void 0 , function * ( ) {
1517 const { data : comments } = yield octokit . issues . listComments ( Object . assign ( Object . assign ( { } , repo ) , { issue_number } ) ) ;
16- return comments . find ( comment => comment . body . startsWith ( HEADER ) ) ;
18+ const h = headerComment ( header ) ;
19+ return comments . find ( comment => comment . body . startsWith ( h ) ) ;
1720 } ) ;
1821}
1922exports . findPreviousComment = findPreviousComment ;
20- function updateComment ( octokit , repo , comment_id , body ) {
23+ function updateComment ( octokit , repo , comment_id , body , header ) {
2124 return __awaiter ( this , void 0 , void 0 , function * ( ) {
22- yield octokit . issues . updateComment ( Object . assign ( Object . assign ( { } , repo ) , { comment_id, body : `${ HEADER } \n${ body } ` } ) ) ;
25+ yield octokit . issues . updateComment ( Object . assign ( Object . assign ( { } , repo ) , { comment_id, body : `${ headerComment ( header ) } \n${ body } ` } ) ) ;
2326 } ) ;
2427}
2528exports . updateComment = updateComment ;
26- function createComment ( octokit , repo , issue_number , body ) {
29+ function createComment ( octokit , repo , issue_number , body , header ) {
2730 return __awaiter ( this , void 0 , void 0 , function * ( ) {
28- yield octokit . issues . createComment ( Object . assign ( Object . assign ( { } , repo ) , { issue_number, body : `${ HEADER } \n${ body } ` } ) ) ;
31+ yield octokit . issues . createComment ( Object . assign ( Object . assign ( { } , repo ) , { issue_number, body : `${ headerComment ( header ) } \n${ body } ` } ) ) ;
2932 } ) ;
3033}
3134exports . createComment = createComment ;
0 commit comments