# EventAction

The types of webhook event actions.

- Source: [`aws-codebuild/lib/source.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-codebuild/lib/source.ts#L167)
- Type last changed: v2.146.0 · 13 Jun 2024

## Example

TypeScript:

```ts
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
});
```

Python:

```python
git_hub_source = codebuild.Source.git_hub(
    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
    webhook_triggers_batch_build=True,  # optional, default is false
    webhook_filters=[
        codebuild.FilterGroup.in_event_of(codebuild.EventAction.PUSH).and_branch_is("main").and_commit_message_is("the commit message"),
        codebuild.FilterGroup.in_event_of(codebuild.EventAction.RELEASED).and_branch_is("main")
    ]
)
```

Java:

```java
ISource gitHubSource = Source.gitHub(GitHubSourceProps.builder()
        .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(List.of(FilterGroup.inEventOf(EventAction.PUSH).andBranchIs("main").andCommitMessageIs("the commit message"), FilterGroup.inEventOf(EventAction.RELEASED).andBranchIs("main")))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var gitHubSource = Source.GitHub(new GitHubSourceProps {
    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 = new [] { FilterGroup.InEventOf(EventAction.PUSH).AndBranchIs("main").AndCommitMessageIs("the commit message"), FilterGroup.InEventOf(EventAction.RELEASED).AndBranchIs("main") }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
gitHubSource := codebuild.Source_GitHub(&GitHubSourceProps{
	Owner: jsii.String("awslabs"),
	Repo: jsii.String("aws-cdk"),
	 // optional, default: undefined if unspecified will create organization webhook
	Webhook: jsii.Boolean(true),
	 // optional, default: true if `webhookFilters` were provided, false otherwise
	WebhookTriggersBatchBuild: jsii.Boolean(true),
	 // optional, default is false
	WebhookFilters: []FilterGroup{
		codebuild.FilterGroup_InEventOf(codebuild.EventAction_PUSH).AndBranchIs(jsii.String("main")).AndCommitMessageIs(jsii.String("the commit message")),
		codebuild.FilterGroup_*InEventOf(codebuild.EventAction_RELEASED).*AndBranchIs(jsii.String("main")),
	},
})
```

## Members

| Member | Description |
| --- | --- |
| `PUSH` | A push (of a branch, or a tag) to the repository. |
| `PULL_REQUEST_CREATED` | Creating a Pull Request. |
| `PULL_REQUEST_UPDATED` | Updating a Pull Request. |
| `PULL_REQUEST_CLOSED` | Closing a Pull Request. |
| `PULL_REQUEST_MERGED` | Merging a Pull Request. |
| `PULL_REQUEST_REOPENED` | Re-opening a previously closed Pull Request. |
| `RELEASED` | A release is created in the repository. |
| `PRERELEASED` | A prerelease is created in the repository. |
| `WORKFLOW_JOB_QUEUED` | A workflow job is queued in the repository. |
