class FilterGroup
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodeBuild.FilterGroup |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscodebuild#FilterGroup |
Java | software.amazon.awscdk.services.codebuild.FilterGroup |
Python | aws_cdk.aws_codebuild.FilterGroup |
TypeScript (source) | aws-cdk-lib » aws_codebuild » FilterGroup |
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
Name | Description |
---|---|
and | Create a new FilterGroup with an added condition: the account ID of the actor initiating the event must match the given pattern. |
and | Create a new FilterGroup with an added condition: the account ID of the actor initiating the event must not match the given pattern. |
and | Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must target the given base branch. |
and | Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must not target the given base branch. |
and | Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must target the given Git reference. |
and | Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must not target the given Git reference. |
and | Create a new FilterGroup with an added condition: the event must affect the given branch. |
and | Create a new FilterGroup with an added condition: the event must not affect the given branch. |
and | Create a new FilterGroup with an added condition: the event must affect a head commit with the given message. |
and | Create a new FilterGroup with an added condition: the event must not affect a head commit with the given message. |
and | Create a new FilterGroup with an added condition: the push that is the source of the event must affect a file that matches the given pattern. |
and | Create a new FilterGroup with an added condition: the push that is the source of the event must not affect a file that matches the given pattern. |
and | Create a new FilterGroup with an added condition: the event must affect a Git reference (ie., a branch or a tag) that matches the given pattern. |
and | Create a new FilterGroup with an added condition: the event must not affect a Git reference (ie., a branch or a tag) that matches the given pattern. |
and | Create a new FilterGroup with an added condition: the push that is the source of the event affect only a repository name that matches the given pattern. |
and | Create a new FilterGroup with an added condition: the push that is the source of the event must not affect a repository name that matches the given pattern. |
and | Create a new FilterGroup with an added condition: the event must affect the given tag. |
and | Create a new FilterGroup with an added condition: the event must not affect the given tag. |
static in | Creates a new event FilterGroup that triggers on any of the provided actions. |
andActorAccountIs(pattern)
public andActorAccountIs(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the account ID of the actor initiating the event must match the given pattern.
andActorAccountIsNot(pattern)
public andActorAccountIsNot(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the account ID of the actor initiating the event must not match the given pattern.
andBaseBranchIs(branchName)
public andBaseBranchIs(branchName: string): FilterGroup
Parameters
- branchName
string
— the name of the branch (can be a regular expression).
Returns
Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must target the given base branch.
Note that you cannot use this method if this Group contains the PUSH
event action.
andBaseBranchIsNot(branchName)
public andBaseBranchIsNot(branchName: string): FilterGroup
Parameters
- branchName
string
— the name of the branch (can be a regular expression).
Returns
Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must not target the given base branch.
Note that you cannot use this method if this Group contains the PUSH
event action.
andBaseRefIs(pattern)
public andBaseRefIs(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must target the given Git reference.
Note that you cannot use this method if this Group contains the PUSH
event action.
andBaseRefIsNot(pattern)
public andBaseRefIsNot(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must not target the given Git reference.
Note that you cannot use this method if this Group contains the PUSH
event action.
andBranchIs(branchName)
public andBranchIs(branchName: string): FilterGroup
Parameters
- branchName
string
— the name of the branch (can be a regular expression).
Returns
Create a new FilterGroup with an added condition: the event must affect the given branch.
andBranchIsNot(branchName)
public andBranchIsNot(branchName: string): FilterGroup
Parameters
- branchName
string
— the name of the branch (can be a regular expression).
Returns
Create a new FilterGroup with an added condition: the event must not affect the given branch.
andCommitMessageIs(commitMessage)
public andCommitMessageIs(commitMessage: string): FilterGroup
Parameters
- commitMessage
string
— the commit message (can be a regular expression).
Returns
Create a new FilterGroup with an added condition: the event must affect a head commit with the given message.
andCommitMessageIsNot(commitMessage)
public andCommitMessageIsNot(commitMessage: string): FilterGroup
Parameters
- commitMessage
string
— the commit message (can be a regular expression).
Returns
Create a new FilterGroup with an added condition: the event must not affect a head commit with the given message.
andFilePathIs(pattern)
public andFilePathIs(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the push that is the source of the event must affect a file that matches the given pattern.
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.
andFilePathIsNot(pattern)
public andFilePathIsNot(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the push that is the source of the event must not affect a file that matches the given pattern.
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.
andHeadRefIs(pattern)
public andHeadRefIs(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the event must affect a Git reference (ie., a branch or a tag) that matches the given pattern.
andHeadRefIsNot(pattern)
public andHeadRefIsNot(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the event must not affect a Git reference (ie., a branch or a tag) that matches the given pattern.
andRepositoryNameIs(pattern)
public andRepositoryNameIs(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the push that is the source of the event affect only a repository name that matches the given pattern.
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.
andRepositoryNameIsNot(pattern)
public andRepositoryNameIsNot(pattern: string): FilterGroup
Parameters
- pattern
string
— a regular expression.
Returns
Create a new FilterGroup with an added condition: the push that is the source of the event must not affect a repository name that matches the given pattern.
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.
andTagIs(tagName)
public andTagIs(tagName: string): FilterGroup
Parameters
- tagName
string
— the name of the tag (can be a regular expression).
Returns
Create a new FilterGroup with an added condition: the event must affect the given tag.
andTagIsNot(tagName)
public andTagIsNot(tagName: string): FilterGroup
Parameters
- tagName
string
— the name of the tag (can be a regular expression).
Returns
Create a new FilterGroup with an added condition: the event must not affect the given tag.
static inEventOf(...actions)
public static inEventOf(...actions: EventAction[]): FilterGroup
Parameters
- actions
Event
— the actions to trigger the webhook on.Action
Returns
Creates a new event FilterGroup that triggers on any of the provided actions.