GitHub webhook events
You can use webhook filter groups to specify which GitHub webhook events trigger a build. For example, you can specify that a build is only triggered for changes to specific branches.
You can create one or more webhook filter groups to specify which webhook events trigger a build. A build is triggered if any filter group evaluates to true, which occurs when all the filters in the group evaluate to true. When you create a filter group, you specify:
- An event
- 
                For GitHub, you can choose one or more of the following events: PUSH,PULL_REQUEST_CREATED,PULL_REQUEST_UPDATED,PULL_REQUEST_REOPENED,PULL_REQUEST_MERGED,PULL_REQUEST_CLOSED,RELEASED,PRERELEASED, andWORKFLOW_JOB_QUEUED. The webhook event type is in theX-GitHub-Eventheader in the webhook payload. In theX-GitHub-Eventheader, you might seepull_requestorpush. For a pull request event, the type is in theactionfield of the webhook event payload. The following table shows howX-GitHub-Eventheader values and webhook pull request payloadactionfield values map to the available event types.X-GitHub-EventHeader valueWebhook event payload actionvalueEvent type pull_requestopenedPULL_REQUEST_CREATEDpull_requestreopenedPULL_REQUEST_REOPENEDpull_requestsynchronizePULL_REQUEST_UPDATEDpull_requestclosed, and themergedfield istruePULL_REQUEST_MERGEDpull_requestclosed, and themergedfield isfalsePULL_REQUEST_CLOSEDpushn/a PUSHreleasereleased RELEASEDreleaseprereleased PRERELEASEDworkflow_jobqueued WORKFLOW_JOB_QUEUEDNoteThe PULL_REQUEST_REOPENEDevent type can be used with GitHub and GitHub Enterprise Server only. TheRELEASEDandPRERELEASEDevent type can be used with GitHub only. For more information onWORKFLOW_JOB_QUEUED, see Tutorial: Configure a CodeBuild-hosted GitHub Actions runner.
- One or more optional filters
- 
                Use a regular expression to specify a filter. For an event to trigger a build, every filter within the group associated with it must evaluate to true. - ACTOR_ACCOUNT_ID(- ACTOR_IDin the console)
- 
                            A webhook event triggers a build when a GitHub or GitHub Enterprise Server account ID matches the regular expression pattern. This value is found in the idproperty of thesenderobject in the webhook payload.
- HEAD_REF
- 
                            A webhook event triggers a build when the head reference matches the regular expression pattern (for example, refs/heads/branch-nameorrefs/tags/tag-name). For a push event, the reference name is found in therefproperty in the webhook payload. For pull requests events, the branch name is found in therefproperty of theheadobject in the webhook payload.
- BASE_REF
- 
                            A webhook event triggers a build when the base reference matches the regular expression pattern (for example, refs/heads/branch-name). ABASE_REFfilter can be used with pull request events only. The branch name is found in therefproperty of thebaseobject in the webhook payload.
- FILE_PATH
- 
                            A webhook triggers a build when the path of a changed file matches the regular expressions pattern. A FILE_PATHfilter can be used with GitHub push and pull request events and GitHub Enterprise Server push events. It cannot be used with GitHub Enterprise Server pull request events.
- COMMIT_MESSAGE
- 
                            A webhook triggers a build when the head commit message matches the regular expression pattern. A COMMIT_MESSAGEfilter can be used with GitHub push and pull request events and GitHub Enterprise Server push events. It cannot be used with GitHub Enterprise Server pull request events.
- TAG_NAME
- 
                            A webhook triggers a build when the tag name of the release matches the regular expression pattern. A TAG_NAMEfilter can be used with GitHub released and prereleased request events.
- RELEASE_NAME
- 
                            A webhook triggers a build when the release name matches the regular expression pattern. A RELEASE_NAMEfilter can be used with GitHub released and prereleased request events.
- REPOSITORY_NAME
- 
                            A webhook triggers a build when the repository name matches the regular expression pattern. A REPOSITORY_NAMEfilter can only be used with GitHub global or organization webhooks.
- ORGANIZATION_NAME
- 
                            A webhook triggers a build when the organization name matches the regular expression pattern. A ORGANIZATION_NAMEfilter can only be used with GitHub global webhooks.
- WORKFLOW_NAME
- 
                            A webhook triggers a build when the workflow name matches the regular expression pattern. A WORKFLOW_NAMEfilter can be used with GitHub Actions workflow job queued request events.
 
Note
You can find the webhook payload in the webhook settings of your GitHub repository.