You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constPR_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.';
15
+
14
16
/**
15
17
* Types of exemption labels in aws-cdk project.
16
18
*/
@@ -268,6 +270,16 @@ export class PullRequestLinter {
268
270
body,
269
271
});
270
272
273
+
// Commenting this code to first test that linter rule works
274
+
// since this can lead to other PRs closing if not setup correctly
275
+
// // Closing the PR if it is opened from main branch of author's fork
276
+
// if (failureMessages.includes(PR_FROM_MAIN_ERROR)) {
277
+
// await this.client.pulls.update({
278
+
// ...this.prParams,
279
+
// state: 'closed',
280
+
// });
281
+
// }
282
+
271
283
thrownewLinterError(body);
272
284
}
273
285
@@ -508,6 +520,9 @@ export class PullRequestLinter {
508
520
validationCollector.validateRuleSet({
509
521
testRuleSet: [{test: validateTitleScope}],
510
522
});
523
+
validationCollector.validateRuleSet({
524
+
testRuleSet: [{test: validateBranch}],
525
+
})
511
526
512
527
validationCollector.validateRuleSet({
513
528
exemption: shouldExemptBreakingChange,
@@ -687,6 +702,22 @@ function validateTitleScope(pr: GitHubPr): TestResult {
687
702
returnresult;
688
703
}
689
704
705
+
/**
706
+
* Check that the PR is not opened from main branch of author's fork
0 commit comments