Start running builds automatically (Amazon CLI) - Amazon CodeBuild
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Start running builds automatically (Amazon CLI)

If your source code is stored in a GitHub or a GitHub Enterprise Server repository, you can use GitHub webhooks to have Amazon CodeBuild rebuild your source code whenever a code change is pushed to the repository.

Run the create-webhook command as follows:

aws codebuild create-webhook --project-name <project-name>

<project-name> is the name of the build project that contains the source code to be rebuilt.

For GitHub, information similar to the following appears in the output:

{ "webhook": { "url": "<url>" } }

<url> is the URL to the GitHub webhook.

For GitHub Enterprise Server, information similar to the following appears in the output:

  1. Copy the secret key and payload URL from the output. You need them to add a webhook in GitHub Enterprise Server.

  2. In GitHub Enterprise Server, choose the repository where your CodeBuild project is stored. Choose Settings, choose Hooks & services, and then choose Add webhook.

  3. Enter the payload URL and secret key, accept the defaults for the other fields, and then choose Add webhook.