@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
}
37
37
} ;
38
38
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
39
- exports . comment = exports . getPrComment = exports . formPrComment = exports . PR_COMMENT_START = exports . generateProgressDetails = exports . statusToMark = exports . generateProgressSummary = exports . generateProgressReport = void 0 ;
39
+ exports . commentOnPr = exports . generateProgressDetails = exports . generateProgressSummary = void 0 ;
40
40
var generateProgressReport = function ( subprojects , checksStatusLookup ) {
41
41
var report = {
42
42
completed : [ ] ,
@@ -75,10 +75,9 @@ var generateProgressReport = function (subprojects, checksStatusLookup) {
75
75
} ) ;
76
76
return report ;
77
77
} ;
78
- exports . generateProgressReport = generateProgressReport ;
79
78
var generateProgressSummary = function ( subprojects , checksStatusLookup ) {
80
79
var _a , _b ;
81
- var report = ( 0 , exports . generateProgressReport ) ( subprojects , checksStatusLookup ) ;
80
+ var report = generateProgressReport ( subprojects , checksStatusLookup ) ;
82
81
var message = "Progress: " . concat ( ( _a = report . completed ) === null || _a === void 0 ? void 0 : _a . length , " completed, " ) . concat ( ( _b = report . running ) === null || _b === void 0 ? void 0 : _b . length , " pending" ) ;
83
82
return message ;
84
83
} ;
@@ -97,7 +96,6 @@ var statusToMark = function (check, checksStatusLookup) {
97
96
}
98
97
return "❓" ;
99
98
} ;
100
- exports . statusToMark = statusToMark ;
101
99
/**
102
100
* Generates a progress report for currently finished checks
103
101
* which will be posted in the status check report.
@@ -113,7 +111,7 @@ var generateProgressDetails = function (subprojects, checksStatusLookup) {
113
111
// for padding
114
112
var longestLength = Math . max . apply ( Math , ( subproject . checks . map ( function ( check ) { return check . id . length ; } ) ) ) ;
115
113
subproject . checks . forEach ( function ( check ) {
116
- var mark = ( 0 , exports . statusToMark ) ( check . id , checksStatusLookup ) ;
114
+ var mark = statusToMark ( check . id , checksStatusLookup ) ;
117
115
var status = ( check . id in checksStatusLookup ) ? checksStatusLookup [ check . id ] : 'no_status' ;
118
116
status = status || 'undefined' ;
119
117
progress += "" . concat ( check . id . padEnd ( longestLength , ' ' ) , " | " ) . concat ( mark , " | " ) . concat ( status . padEnd ( 12 , ' ' ) , "\n" ) ;
@@ -127,7 +125,7 @@ var generateProgressDetails = function (subprojects, checksStatusLookup) {
127
125
longestLength = Math . max ( longestLength , availableCheck . length ) ;
128
126
}
129
127
for ( var availableCheck in checksStatusLookup ) {
130
- var mark = ( 0 , exports . statusToMark ) ( availableCheck , checksStatusLookup ) ;
128
+ var mark = statusToMark ( availableCheck , checksStatusLookup ) ;
131
129
var status_2 = ( availableCheck in checksStatusLookup ) ? checksStatusLookup [ availableCheck ] : 'no_status' ;
132
130
status_2 = status_2 || 'undefined' ;
133
131
progress += "" . concat ( availableCheck . padEnd ( longestLength , ' ' ) , " | " ) . concat ( mark , " | " ) . concat ( status_2 . padEnd ( 12 , ' ' ) , "\n" ) ;
@@ -136,16 +134,15 @@ var generateProgressDetails = function (subprojects, checksStatusLookup) {
136
134
return progress ;
137
135
} ;
138
136
exports . generateProgressDetails = generateProgressDetails ;
139
- exports . PR_COMMENT_START = "<!-- checkgroup-comment-start -->" ;
137
+ var PR_COMMENT_START = "<!-- checkgroup-comment-start -->" ;
140
138
function formPrComment ( ) {
141
- return ( exports . PR_COMMENT_START
139
+ return ( PR_COMMENT_START
142
140
+ "\nHello! This is a test"
143
141
+ "\nThis comment was automatically generated by CheckGroup" ) ;
144
142
}
145
- exports . formPrComment = formPrComment ;
146
143
function getPrComment ( context ) {
147
144
return __awaiter ( this , void 0 , void 0 , function ( ) {
148
- var params , commentsRes , _i , _a , comment_1 ;
145
+ var params , commentsRes , _i , _a , comment ;
149
146
return __generator ( this , function ( _b ) {
150
147
switch ( _b . label ) {
151
148
case 0 :
@@ -154,18 +151,17 @@ function getPrComment(context) {
154
151
case 1 :
155
152
commentsRes = _b . sent ( ) ;
156
153
for ( _i = 0 , _a = commentsRes . data ; _i < _a . length ; _i ++ ) {
157
- comment_1 = _a [ _i ] ;
158
- if ( comment_1 . body . includes ( exports . PR_COMMENT_START ) ) {
159
- return [ 2 /*return*/ , { id : comment_1 . id , body : comment_1 . body } ] ;
154
+ comment = _a [ _i ] ;
155
+ if ( comment . body . includes ( PR_COMMENT_START ) ) {
156
+ return [ 2 /*return*/ , { id : comment . id , body : comment . body } ] ;
160
157
}
161
158
}
162
159
return [ 2 /*return*/ , { id : 0 , body : "" } ] ;
163
160
}
164
161
} ) ;
165
162
} ) ;
166
163
}
167
- exports . getPrComment = getPrComment ;
168
- function comment ( context ) {
164
+ function commentOnPr ( context ) {
169
165
return __awaiter ( this , void 0 , void 0 , function ( ) {
170
166
var existingData , newComment ;
171
167
return __generator ( this , function ( _a ) {
@@ -192,4 +188,4 @@ function comment(context) {
192
188
} ) ;
193
189
} ) ;
194
190
}
195
- exports . comment = comment ;
191
+ exports . commentOnPr = commentOnPr ;
0 commit comments