Skip to content

Commit fdaf6bc

Browse files
authored
fix(codebuild): fails on using PR Events together with FILE_PATH filters in a FilterGroup (#9725)
Remove blocking validation on GitHub webhook file path filter when `event` is `PUSH` only. Fixes #8867 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 84a3ef6 commit fdaf6bc

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

packages/@aws-cdk/aws-codebuild/lib/source.ts

-3
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,6 @@ export class FilterGroup {
407407
}
408408

409409
private addFilePathFilter(pattern: string, include: boolean): FilterGroup {
410-
if (this.actions.size !== 1 || !this.actions.has(EventAction.PUSH)) {
411-
throw new Error('A file path condition cannot be added if a Group contains any event action other than PUSH');
412-
}
413410
return this.addFilter(FILE_PATH_WEBHOOK_COND, pattern, include);
414411
}
415412

packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -1631,13 +1631,11 @@ export = {
16311631
test.done();
16321632
},
16331633

1634-
'cannot have file path conditions if the Group contains any action other than PUSH'(test: Test) {
1635-
const filterGroup = codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_CREATED,
1636-
codebuild.EventAction.PUSH);
1637-
1638-
test.throws(() => {
1639-
filterGroup.andFilePathIsNot('.*\\.java');
1640-
}, /A file path condition cannot be added if a Group contains any event action other than PUSH/);
1634+
'can have FILE_PATH filters if the Group contains PUSH and PR_CREATED events'(test: Test) {
1635+
codebuild.FilterGroup.inEventOf(
1636+
codebuild.EventAction.PULL_REQUEST_CREATED,
1637+
codebuild.EventAction.PUSH)
1638+
.andFilePathIsNot('.*\\.java');
16411639

16421640
test.done();
16431641
},

0 commit comments

Comments
 (0)