@@ -221,7 +221,7 @@ export class PullRequestLinter {
221
221
*/
222
222
private async deletePRLinterComment ( ) : Promise < void > {
223
223
// Since previous versions of this pr linter didn't add comments, we need to do this check first.
224
- const comment = await this . findExistingComment ( ) ;
224
+ const comment = await this . findExistingPRLinterComment ( ) ;
225
225
if ( comment ) {
226
226
await this . client . issues . deleteComment ( {
227
227
...this . issueParams ,
@@ -302,7 +302,7 @@ export class PullRequestLinter {
302
302
* Finds existing review, if present
303
303
* @returns Existing review, if present
304
304
*/
305
- private async findExistingReview ( ) : Promise < Review | undefined > {
305
+ private async findExistingPRLinterReview ( ) : Promise < Review | undefined > {
306
306
const reviews = await this . client . pulls . listReviews ( this . prParams ) ;
307
307
return reviews . data . find ( ( review ) => review . user ?. login === 'aws-cdk-automation' && review . state !== 'DISMISSED' ) as Review ;
308
308
}
@@ -311,7 +311,7 @@ export class PullRequestLinter {
311
311
* Finds existing comment from previous review, if present
312
312
* @returns Existing comment, if present
313
313
*/
314
- private async findExistingComment ( ) : Promise < Comment | undefined > {
314
+ private async findExistingPRLinterComment ( ) : Promise < Comment | undefined > {
315
315
const comments = await this . client . issues . listComments ( this . issueParams ) ;
316
316
return comments . data . find ( ( comment ) => comment . user ?. login === 'aws-cdk-automation' && comment . body ?. startsWith ( 'The pull request linter fails with the following errors:' ) ) as Comment ;
317
317
}
@@ -321,7 +321,7 @@ export class PullRequestLinter {
321
321
* @param result The result of the PR Linter run.
322
322
*/
323
323
private async communicateResult ( result : ValidationCollector ) : Promise < void > {
324
- const existingReview = await this . findExistingReview ( ) ;
324
+ const existingReview = await this . findExistingPRLinterReview ( ) ;
325
325
if ( result . isValid ( ) ) {
326
326
console . log ( '✅ Success' ) ;
327
327
await this . dismissPRLinterReview ( existingReview ) ;
@@ -341,6 +341,8 @@ export class PullRequestLinter {
341
341
repo : this . prParams . repo ,
342
342
ref : sha ,
343
343
} ) ;
344
+ let status = statuses . data . filter ( status => status . context === CODE_BUILD_CONTEXT ) . map ( status => status . state ) ;
345
+ console . log ( "CodeBuild Commit Statuses: " , status ) ;
344
346
return statuses . data . some ( status => status . context === CODE_BUILD_CONTEXT && status . state === 'success' ) ;
345
347
}
346
348
@@ -419,6 +421,7 @@ export class PullRequestLinter {
419
421
[ review . user ! . login ] : newest ,
420
422
} ;
421
423
} , { } as Record < string , typeof reviews . data [ 0 ] > ) ;
424
+ console . log ( 'raw data: ' , JSON . stringify ( reviewsByTrustedCommunityMembers ) ) ;
422
425
const communityApproved = Object . values ( reviewsByTrustedCommunityMembers ) . some ( ( { state} ) => state === 'APPROVED' ) ;
423
426
const communityRequestedChanges = ! communityApproved && Object . values ( reviewsByTrustedCommunityMembers ) . some ( ( { state} ) => state === 'CHANGES_REQUESTED' )
424
427
@@ -572,6 +575,7 @@ export class PullRequestLinter {
572
575
] ,
573
576
} ) ;
574
577
578
+ console . log ( "Deleting PR Linter Comment now" ) ;
575
579
await this . deletePRLinterComment ( ) ;
576
580
try {
577
581
await this . communicateResult ( validationCollector ) ;
@@ -580,7 +584,9 @@ export class PullRequestLinter {
580
584
// also assess whether the PR needs review or not
581
585
try {
582
586
const state = await this . codeBuildJobSucceeded ( sha ) ;
587
+ console . log ( `PR code build job ${ state ? "SUCCESSFUL" : "not yet successful" } ` ) ;
583
588
if ( state ) {
589
+ console . log ( 'Assessing if the PR needs a review now' ) ;
584
590
await this . assessNeedsReview ( pr ) ;
585
591
}
586
592
} catch ( e ) {
0 commit comments