ExitAWS CodeBuild: source webhook filtering1 / 7
Explanation

Filter groups are Boolean rules

How webhook filters and source revisions determine which pull requests and merges launch builds and which code they execute. · advanced

A CodeBuild source webhook answers a launch decision: does this repository event qualify for a build? For GitHub, an EVENT filter can list events such as PULL_REQUEST_CREATED,PULL_REQUEST_UPDATED,PULL_REQUEST_REOPENED. Those values are alternatives within that event filter, not three events that must happen together.

Within one filter group, every filter must pass: the relationship is AND. Across groups, the relationship is OR: any matching group admits the event. To build pull requests targeting main, put the pull-request event filter and BASE_REF = ^refs/heads/main$ in the same group. Putting them in separate groups would admit events that satisfy only one condition.

Reference filters use regular expressions; anchors make the whole reference match. Setting excludeMatchedPattern to true reverses that individual filter's result. For example, an excluded HEAD_REF pattern of ^refs/heads/wip/.*$ rejects matching source branches; it does not reverse the entire group.