aws-cdk-lib.aws_codebuild.FilterGroup

class FilterGroup

LanguageType name
.NETAmazon.CDK.AWS.CodeBuild.FilterGroup
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscodebuild#FilterGroup
Javasoftware.amazon.awscdk.services.codebuild.FilterGroup
Pythonaws_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',
  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'),
  ], // optional, by default all pushes and Pull Requests will trigger a build
});

Methods

NameDescription
andActorAccountIs(pattern)Create a new FilterGroup with an added condition: the account ID of the actor initiating the event must match the given pattern.
andActorAccountIsNot(pattern)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)Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must target the given base branch.
andBaseBranchIsNot(branchName)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.
andBaseRefIs(pattern)Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must target the given Git reference.
andBaseRefIsNot(pattern)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.
andBranchIs(branchName)Create a new FilterGroup with an added condition: the event must affect the given branch.
andBranchIsNot(branchName)Create a new FilterGroup with an added condition: the event must not affect the given branch.
andCommitMessageIs(commitMessage)Create a new FilterGroup with an added condition: the event must affect a head commit with the given message.
andCommitMessageIsNot(commitMessage)Create a new FilterGroup with an added condition: the event must not affect a head commit with the given message.
andFilePathIs(pattern)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.
andFilePathIsNot(pattern)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.
andHeadRefIs(pattern)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)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.
andTagIs(tagName)Create a new FilterGroup with an added condition: the event must affect the given tag.
andTagIsNot(tagName)Create a new FilterGroup with an added condition: the event must not affect the given tag.
static inEventOf(...actions)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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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

  • FilterGroup

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.


andTagIs(tagName)

public andTagIs(tagName: string): FilterGroup

Parameters

  • tagName string — the name of the tag (can be a regular expression).

Returns

  • FilterGroup

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

  • FilterGroup

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 EventAction — the actions to trigger the webhook on.

Returns

  • FilterGroup

Creates a new event FilterGroup that triggers on any of the provided actions.