codebuild: Multiple entries in FilterGroup.inEventOf generates incorrect CloudFormation entry
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
```typescript
const project = new Project(this, 'MyProject', {
source: Source.gitHub({
webhook: true,
webhookFilters: [
FilterGroup.inEventOf(
EventAction.PULL_REQUEST_CREATED,
EventAction.PULL_REQUEST_UPDATED,
),
]
})
})
```
This results in a CloudFormation template like this:
```yaml
Triggers:
FilterGroups:
- - Pattern: PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED
Type: EVENT
```
Note the space after the comma.
This doesn't actually work when deployed to AWS using `cdk deploy`; only the first entry is honored, and the CodeBuild UI just shows `PULL_REQUEST_CREATED` as the trigger.
I have confirmed that the space is the issue, by using the following escape hatch, which generates without the space and works correctly on AWS:
```typescript
const cfnProject = project.node.defaultChild as CfnProject
const triggers = cfnProject.triggers as CfnProject.ProjectTriggersProperty
const filterGroups = triggers.filterGroups as CfnProject.WebhookFilterProperty[][]
filterGroups[0].pop()
filterGroups[0].push({
type: 'EVENT',
pattern: 'PULL_REQUEST_CREATED,PULL_REQUEST_UPDATED',
})
```
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
Correct CodeFormation template to be generated.
### Current Behavior
Incorrect CodeFormation template was generated.
### Reproduction Steps
As above.
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.177.0 (build b396961)
### Framework Version
aws-cdk and aws-cdk-lib both 2.177.0
### Node.js Version
v20.14.0
### OS
macOS 15.1.1 (24B91)
### Language
TypeScript
### Language Version
TypeScript 5.5.4
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.