@@ -10,16 +10,7 @@ export type GitHubPr =
10
10
Endpoints [ 'GET /repos/{owner}/{repo}/pulls/{pull_number}' ] [ 'response' ] [ 'data' ] ;
11
11
12
12
export const CODE_BUILD_CONTEXT = 'AWS CodeBuild us-east-1 (AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv)' ;
13
- export const CODECOV_PREFIX = 'codecov/' ;
14
-
15
- export const CODECOV_CHECKS = [
16
- 'patch' ,
17
- 'patch/packages/aws-cdk' ,
18
- 'patch/packages/aws-cdk-lib/core' ,
19
- 'project' ,
20
- 'project/packages/aws-cdk' ,
21
- 'project/packages/aws-cdk-lib/core'
22
- ] ;
13
+
23
14
const PR_FROM_MAIN_ERROR = 'Pull requests from `main` branch of a fork cannot be accepted. Please reopen this contribution from another branch on your fork. For more information, see https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md#step-4-pull-request.' ;
24
15
25
16
/**
@@ -33,7 +24,6 @@ enum Exemption {
33
24
CLI_INTEG_TESTED = 'pr-linter/cli-integ-tested' ,
34
25
REQUEST_CLARIFICATION = 'pr/reviewer-clarification-requested' ,
35
26
REQUEST_EXEMPTION = 'pr-linter/exemption-requested' ,
36
- CODECOV = "pr-linter/exempt-codecov" ,
37
27
}
38
28
39
29
export interface GithubStatusEvent {
@@ -346,23 +336,14 @@ export class PullRequestLinter {
346
336
* @param sha the commit sha to evaluate
347
337
*/
348
338
private async codeBuildJobSucceeded ( sha : string ) : Promise < boolean > {
349
- return this . checkStatusSucceeded ( sha , CODE_BUILD_CONTEXT ) ;
350
- }
351
-
352
- /**
353
- * Check a specific status check to see if it is successful for the given commit
354
- *
355
- * @param sha the commit sha to evaluate
356
- */
357
- private async checkStatusSucceeded ( sha : string , context : string ) : Promise < boolean > {
358
- const statuses = await this . client . paginate ( this . client . repos . listCommitStatusesForRef , {
339
+ const statuses = await this . client . repos . listCommitStatusesForRef ( {
359
340
owner : this . prParams . owner ,
360
341
repo : this . prParams . repo ,
361
342
ref : sha ,
362
343
} ) ;
363
- let status = statuses . filter ( status => status . context === context ) . map ( status => status . state ) ;
364
- console . log ( ` ${ context } statuses: ${ status } ` ) ;
365
- return statuses . some ( status => status . context === context && status . state === 'success' ) ;
344
+ let status = statuses . data . filter ( status => status . context === CODE_BUILD_CONTEXT ) . map ( status => status . state ) ;
345
+ console . log ( "CodeBuild Commit Statuses: " , status ) ;
346
+ return statuses . data . some ( status => status . context === CODE_BUILD_CONTEXT && status . state === 'success' ) ;
366
347
}
367
348
368
349
public async validateStatusEvent ( pr : GitHubPr , status : StatusEvent ) : Promise < void > {
@@ -594,24 +575,6 @@ export class PullRequestLinter {
594
575
] ,
595
576
} ) ;
596
577
597
- const codecovTests : Test [ ] = [ ] ;
598
- for ( const c of CODECOV_CHECKS ) {
599
- const checkName = `${ CODECOV_PREFIX } ${ c } ` ;
600
- const succeeded = await this . checkStatusSucceeded ( sha , checkName ) ;
601
- codecovTests . push ( {
602
- test : ( ) => {
603
- const result = new TestResult ( ) ;
604
- result . assessFailure ( ! succeeded , `${ checkName } job is not succeeding` ) ;
605
- return result ;
606
- }
607
- } )
608
- }
609
-
610
- validationCollector . validateRuleSet ( {
611
- exemption : shouldExemptCodecov ,
612
- testRuleSet : codecovTests ,
613
- } ) ;
614
-
615
578
console . log ( "Deleting PR Linter Comment now" ) ;
616
579
await this . deletePRLinterComment ( ) ;
617
580
try {
@@ -693,10 +656,6 @@ function fixContainsIntegTest(pr: GitHubPr, files: GitHubFile[]): TestResult {
693
656
return result ;
694
657
}
695
658
696
- function shouldExemptCodecov ( pr : GitHubPr ) : boolean {
697
- return hasLabel ( pr , Exemption . CODECOV ) ;
698
- }
699
-
700
659
function shouldExemptReadme ( pr : GitHubPr ) : boolean {
701
660
return hasLabel ( pr , Exemption . README ) ;
702
661
}
0 commit comments