FilterGroup Class
An object that represents a group of filter conditions for a webhook.
Every condition in a given FilterGroup must be true in order for the whole group to be true. You construct instances of it by calling the #inEventOf static factory method, and then calling various andXyz instance methods to create modified instances of it (this class is immutable).
You pass instances of this class to the webhookFilters property when constructing a source.
Example
const gitHubSource = codebuild.Source.gitHub({
owner: 'awslabs',
repo: 'aws-cdk', // optional, default: undefined if unspecified will create organization webhook
webhook: true, // optional, default: true if `webhookFilters` were provided, false otherwise
webhookTriggersBatchBuild: true, // optional, default is false
webhookFilters: [
codebuild.FilterGroup
.inEventOf(codebuild.EventAction.PUSH)
.andBranchIs('main')
.andCommitMessageIs('the commit message'),
codebuild.FilterGroup
.inEventOf(codebuild.EventAction.RELEASED)
.andBranchIs('main')
], // optional, by default all pushes and Pull Requests will trigger a build
});
Methods
andActorAccountIs(pattern: string): FilterGroup // chainabledef and_actor_account_is(self, pattern: str) -> FilterGrouppublic FilterGroup andActorAccountIs(String pattern)public FilterGroup AndActorAccountIs(string pattern)func AndActorAccountIs(Pattern *string) FilterGroup#1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andActorAccountIsNot(pattern: string): FilterGroup // chainabledef and_actor_account_is_not(self, pattern: str) -> FilterGrouppublic FilterGroup andActorAccountIsNot(String pattern)public FilterGroup AndActorAccountIsNot(string pattern)func AndActorAccountIsNot(Pattern *string) FilterGroup#1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andBaseBranchIs(branchName: string): FilterGroup // chainabledef and_base_branch_is(self, branch_name: str) -> FilterGrouppublic FilterGroup andBaseBranchIs(String branchName)public FilterGroup AndBaseBranchIs(string branchName)func AndBaseBranchIs(BranchName *string) FilterGroup#Note that you cannot use this method if this Group contains the PUSH event action.
1 parameter
Parameters
branchNamebranch_namebranchNamebranchNameBranchName— the name of the branch (can be a regular expression).
andBaseBranchIsNot(branchName: string): FilterGroup // chainabledef and_base_branch_is_not(self, branch_name: str) -> FilterGrouppublic FilterGroup andBaseBranchIsNot(String branchName)public FilterGroup AndBaseBranchIsNot(string branchName)func AndBaseBranchIsNot(BranchName *string) FilterGroup#Note that you cannot use this method if this Group contains the PUSH event action.
1 parameter
Parameters
branchNamebranch_namebranchNamebranchNameBranchName— the name of the branch (can be a regular expression).
andBaseRefIs(pattern: string): FilterGroup // chainabledef and_base_ref_is(self, pattern: str) -> FilterGrouppublic FilterGroup andBaseRefIs(String pattern)public FilterGroup AndBaseRefIs(string pattern)func AndBaseRefIs(Pattern *string) FilterGroup#Note that you cannot use this method if this Group contains the PUSH event action.
1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andBaseRefIsNot(pattern: string): FilterGroup // chainabledef and_base_ref_is_not(self, pattern: str) -> FilterGrouppublic FilterGroup andBaseRefIsNot(String pattern)public FilterGroup AndBaseRefIsNot(string pattern)func AndBaseRefIsNot(Pattern *string) FilterGroup#Note that you cannot use this method if this Group contains the PUSH event action.
1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andBranchIs(branchName: string): FilterGroup // chainabledef and_branch_is(self, branch_name: str) -> FilterGrouppublic FilterGroup andBranchIs(String branchName)public FilterGroup AndBranchIs(string branchName)func AndBranchIs(BranchName *string) FilterGroup#1 parameter
Parameters
branchNamebranch_namebranchNamebranchNameBranchName— the name of the branch (can be a regular expression).
andBranchIsNot(branchName: string): FilterGroup // chainabledef and_branch_is_not(self, branch_name: str) -> FilterGrouppublic FilterGroup andBranchIsNot(String branchName)public FilterGroup AndBranchIsNot(string branchName)func AndBranchIsNot(BranchName *string) FilterGroup#1 parameter
Parameters
branchNamebranch_namebranchNamebranchNameBranchName— the name of the branch (can be a regular expression).
andCommitMessageIs(commitMessage: string): FilterGroup // chainabledef and_commit_message_is(self, commit_message: str) -> FilterGrouppublic FilterGroup andCommitMessageIs(String commitMessage)public FilterGroup AndCommitMessageIs(string commitMessage)func AndCommitMessageIs(CommitMessage *string) FilterGroup#1 parameter
Parameters
commitMessagecommit_messagecommitMessagecommitMessageCommitMessage— the commit message (can be a regular expression).
andCommitMessageIsNot(commitMessage: string): FilterGroup // chainabledef and_commit_message_is_not(self, commit_message: str) -> FilterGrouppublic FilterGroup andCommitMessageIsNot(String commitMessage)public FilterGroup AndCommitMessageIsNot(string commitMessage)func AndCommitMessageIsNot(CommitMessage *string) FilterGroup#1 parameter
Parameters
commitMessagecommit_messagecommitMessagecommitMessageCommitMessage— the commit message (can be a regular expression).
andFilePathIs(pattern: string): FilterGroup // chainabledef and_file_path_is(self, pattern: str) -> FilterGrouppublic FilterGroup andFilePathIs(String pattern)public FilterGroup AndFilePathIs(string pattern)func AndFilePathIs(Pattern *string) FilterGroup#Note that you can only use this method if this Group contains only the PUSH event action, and only for GitHub, Bitbucket and GitHubEnterprise sources.
1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andFilePathIsNot(pattern: string): FilterGroup // chainabledef and_file_path_is_not(self, pattern: str) -> FilterGrouppublic FilterGroup andFilePathIsNot(String pattern)public FilterGroup AndFilePathIsNot(string pattern)func AndFilePathIsNot(Pattern *string) FilterGroup#Note that you can only use this method if this Group contains only the PUSH event action, and only for GitHub, Bitbucket and GitHubEnterprise sources.
1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andHeadRefIs(pattern: string): FilterGroup // chainabledef and_head_ref_is(self, pattern: str) -> FilterGrouppublic FilterGroup andHeadRefIs(String pattern)public FilterGroup AndHeadRefIs(string pattern)func AndHeadRefIs(Pattern *string) FilterGroup#1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andHeadRefIsNot(pattern: string): FilterGroup // chainabledef and_head_ref_is_not(self, pattern: str) -> FilterGrouppublic FilterGroup andHeadRefIsNot(String pattern)public FilterGroup AndHeadRefIsNot(string pattern)func AndHeadRefIsNot(Pattern *string) FilterGroup#1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andRepositoryNameIs(pattern: string): FilterGroup // chainabledef and_repository_name_is(self, pattern: str) -> FilterGrouppublic FilterGroup andRepositoryNameIs(String pattern)public FilterGroup AndRepositoryNameIs(string pattern)func AndRepositoryNameIs(Pattern *string) FilterGroup#Note that you can only use this method if this Group contains only the WORKFLOW_JOB_QUEUED event action, only for GitHub sources and only for organization webhook.
1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andRepositoryNameIsNot(pattern: string): FilterGroup // chainabledef and_repository_name_is_not(self, pattern: str) -> FilterGrouppublic FilterGroup andRepositoryNameIsNot(String pattern)public FilterGroup AndRepositoryNameIsNot(string pattern)func AndRepositoryNameIsNot(Pattern *string) FilterGroup#Note that you can only use this method if this Group contains only the WORKFLOW_JOB_QUEUED event action, only for GitHub sources and only for organization webhook.
1 parameter
Parameters
patternpatternpatternpatternPattern— a regular expression.
andTagIs(tagName: string): FilterGroup // chainabledef and_tag_is(self, tag_name: str) -> FilterGrouppublic FilterGroup andTagIs(String tagName)public FilterGroup AndTagIs(string tagName)func AndTagIs(TagName *string) FilterGroup#1 parameter
Parameters
tagNametag_nametagNametagNameTagName— the name of the tag (can be a regular expression).
andTagIsNot(tagName: string): FilterGroup // chainabledef and_tag_is_not(self, tag_name: str) -> FilterGrouppublic FilterGroup andTagIsNot(String tagName)public FilterGroup AndTagIsNot(string tagName)func AndTagIsNot(TagName *string) FilterGroup#1 parameter
Parameters
tagNametag_nametagNametagNameTagName— the name of the tag (can be a regular expression).
inEventOf(...actions: EventAction[]): FilterGroup // chainable@staticmethod def in_event_of(actions: EventAction) -> FilterGrouppublic static FilterGroup inEventOf(EventAction actions)public static FilterGroup InEventOf(EventAction actions)func InEventOf(Actions EventAction) FilterGroupstatic#1 parameter
Parameters
actionsactionsactionsactionsActions— the actions to trigger the webhook on.